{"id":19831241,"url":"https://github.com/ryanflannery/vitunes","last_synced_at":"2025-07-09T15:38:11.834Z","repository":{"id":1234658,"uuid":"1170246","full_name":"ryanflannery/vitunes","owner":"ryanflannery","description":"A curses media indexer and player for vi users","archived":false,"fork":false,"pushed_at":"2016-03-15T05:16:04.000Z","size":1262,"stargazers_count":55,"open_issues_count":21,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-11T13:48:51.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.vitunes.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bborn/communityengine","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanflannery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-15T05:21:06.000Z","updated_at":"2022-11-23T15:13:43.000Z","dependencies_parsed_at":"2022-08-16T12:40:29.372Z","dependency_job_id":null,"html_url":"https://github.com/ryanflannery/vitunes","commit_stats":null,"previous_names":[],"tags_count":5,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanflannery%2Fvitunes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanflannery%2Fvitunes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanflannery%2Fvitunes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanflannery%2Fvitunes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanflannery","download_url":"https://codeload.github.com/ryanflannery/vitunes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224265624,"owners_count":17282975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T11:29:37.792Z","updated_at":"2025-07-09T15:38:11.120Z","avatar_url":"https://github.com/ryanflannery.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"vitunes\n=======\n\nA no-fluff media player \u0026 indexer, for vi users.\n\nSee http://vitunes.org for more information about vitunes.\nThe rest of this README is for developers interested in hacking vitunes.\n\n### Building \u0026 Installing\n\n    $ ./configure          // build config.mk\n    $ make                 // build vitunes\n    $ make install         // install binary \u0026 man pages\n    $ make test            // run unit tests (sparse for now)\n\n### Utilities\n\n * [doxygen](https://rawgit.com/ryanflannery/vitunes/master/doc/doxygen/html/index.html)\n   Update with `make doxygen`.\n   Raw for right now. Buidling this out.\n * [cppcheck results](https://rawgit.com/ryanflannery/vitunes/master/doc/cppcheck/results.txt)\n   Update with `make cppcheck`\n * [flawfinder results](https://rawgit.com/ryanflannery/vitunes/master/doc/flawfinder/results.txt)\n   Update with `make flawfinder`\n * [scan-build](https://rawgit.com/ryanflannery/vitunes/master/doc/scan-build/index.html)\n   Update with `make scan-build` and move results into scan-build directory\n\n\nIntroduction\n------------\nFor the hacking sort, this document may help navigate the source code to\nvitunes.  ...and myself, 18 months from now when I dive back into vitunes.\n\nFor list of current todo's, known bug's, or other stuff to work on, grep the\nsource for `TODO`s and `FIXME`s.  Note that `XXX` is used only for important\nnotes.  For longer stuff (big, long-term to-do's), there's an up-to-date list\nat the bottom of this file.\n\nBelow you'll find 3 sections.\n 1. Media-Library Structure: a quick overview of how the media is handled\n 2. Code-Structure: Notable Globals.  Listing of the 3 key global structs\n 3. Code-Structure: The Modules.  Overview of each of the 9 modules.\n\nCare has also been taken to make all .h files briefly document the API\ntherein.  This should be maintained.\n\nThis should be enough for most to jump-into hacking on vitunes.\n\nFor debugging (which can be painful in a curses application), see `debug.h`\nand what happens when you `make -DDEBUG`.  Two macros are created, one to\nlog to a file (`DFLOG`) and one to log to the console (`DCLOG`).  The log\nfile (`vitunes-debug.log`) is opened in `vitunes.c` if `-DDEBUG`.\n\n\nMedia Library Structure\n-----------------------\nBefore hacking on vitunes, it's important to understand the following about\nthe overall structure.\n\n*  vitunes works by maintaining a database of all known files in\n   `~/.vitunes/vitunes.db`\n*  The database is initialized, updated, and stuff added to it via, commands\n   like\n\n         $ vitunes -e init\n         $ vitunes -e update\n         $ vitunes -e add ~/music  /path/to/more/music ...\n         $ vitunes -e addurl \"http://....\"\n\n   See `vitunes -e help` for more details.\n*  If a media file is not in the database, vitunes cannot play it.\n*  Once the database is setup, vitunes can be run normally as `vitunes`\n*  Once vitunes is run normally, one can browse the library, filter,\n   sort, search, copy/paste/delete/etc and create new playlists.  All\n   playlists are stored in `~/.vitunes/playlists/`\n   by default.\n*  The playlist files themselves contain nothing more than the absolute\n   paths (via `realpath(3)`) to the media files contained in the database.\n   There is no meta information in playlists.  All meta information is\n   in the database.\n*  media playback is done with either\n   1. a `fork()`'d instance of `mplayer` [2], or\n   2. `gstreamer`\n*  extracting meta-information from media files is done with the TagLib\n   library [1], used in `mi_extract()` (`meta_info.*`) for extraction, and\n   in `ecmd_tag()` (`vitunes.c`) for tagging.\n\n\nCode Structure: Notable Globals\n-------------------------------\nvitunes maintains a few key global objects (structs) that are used\nthroughout much of the code.  They are:\n\n    mdb         Maintains all information about the media library,\n                including the database (an array of `meta_info*`s), all\n                playlists, and the filter results.\n                See `medialib.h` for more info.\n\n    player      Maintains all information about the `fork()`'d child\n                process of that handles playback, including pipes to\n                read/write to the process, the currently playing playlist\n                \u0026 song.  See player.h for more info.\n\n    player_status\n                Maintains record keeping about what the media player is\n                up to.  Is is playing, paused, and what position (in\n                seconds) into the current file is it?  See `player.h` for\n                more info.\n\n    ui          Maintains all key information about the display and each\n                of the 4 windows.  Of key interest are the two\n                \"scrollable-windows\" (the library and playlist windows).\n                The struct maintains their vertical/horizontal scroll\n                offsets, and a few more things.\n                See `uinterface.h` for more info.\n\nThere are other globals, but few are \"exported\" in any of the .h files.\nThese include global structs in:\n\n    meta_info.c       For maintaining the current display description,\n                      sort description, and search/query filter.  With\n                      the exception of the display description, none of\n                      these are exported, and should not be.\n\n    paint.c           For maintaining the colors used for painting all\n                      of the text to curses.\n\n\nCode Structure: The Modules\n---------------------------\nFirst, the basic configuration is all done in `config.h`.  Specifically,\n   *  keybindings\n   *  command-mode bindings\n   *  a few other defaults (library width, path to mplayer, etc.)\nis all done there.  See that for quick fixes.\n\nAfter that, the source code for vitunes is broken into 9 modules, each\nrelatively small.  A brief description of each follows, starting with the\nsmallest.  Note the code-naming conventions and which ones export a\nglobal object that is used throughout the other modules.\n\nTracing through the source code from \"main\" to keybindings is, at this\npoint, relatively straight-forward.\n\n\n    MODULE            DESCRIPTION\n    --------------    ----------------------------------------------------------\n    str2argv          Contains only 2 functions used elsewhere.  They are used\n                      for converting a string (char*) to an 'int argc' and\n                      'char *argv[]' pair, used for the command-mode function\n                      bindings.  The second function is used to free() a\n                      previously built argc/argv structure.\n\n    player            Contains all of the code to handle the child-process that\n                      handles media playback.  Includes loading files for\n                      playback, pausing, seeking, etc.\n\n                      Naming Convention:   player_*\n                      Global Variables Exported:\n                         player        - Record keeping for the child process.\n                         player_status - Record keeping about the playback\n                                         itself (paused, position, etc.).\n\n    meta_info         Contains all of the code to extract the meta information\n                      (artist name, album name, song title, track number, genre,\n                      and year) from a media-file.  It makes uses of the\n                      external TagLib library [1].  It contains a simple struct\n                      used to represent all such info (meta_info).\n\n                      In addition to this, the logic for sorting songs,\n                      searching/filtering songs, and changing their display in\n                      vitunes is contained here.\n\n                      Naming Convention:   mi_*\n                      Global Variables Exported:\n                         mi_display  -  Description of the current display\n                                        format.\n\n    playlist          Contains all of the code to represent and work with\n                      playlists, which is a simple struct containing an array\n                      of meta_info's.  Nothing more.\n\n                      Naming Convention:   playlist_*\n\n    medialib          Contains all of the code to represent the media library,\n                      which is the database of all known files and array of all\n                      playlists.  Handles initializing, loading, updating, and\n                      adding to the database.\n\n                      Naming Convention:   medialib_*\n                      Global Variables Exported:\n                         mdb   - The global media-library struct, containing\n                                 the database of known files and playlists.\n\n    uinterface        A small abstraction layer on top of curses(3), mostly for\n                      record keeping.  Provides the code to setup the 4 windows,\n                      resizing, and hiding/unhiding the library wndow.\n\n                      Naming Convention:   ui_*\n                                           swindow_*\n                      Global Variables Exported:\n                         ui    - The global user interface object, which again\n                                 contains mostly record-keeping info.\n\n    paint             All major display stuff is in here.  Functions for\n                      painting each of the 4 window, error/information\n                      messages, and setting up colors.\n\n                      Naming Convention:   paint_*\n                      Global Variables Exported:\n                         colors   - List of colors used for each colorable\n                                    object in vitunes.\n\n    keybindings       All of the keybinding code is located here, including the\n                      code for the default keybindings, the core bind and\n                      unbind code, and more.\n\n    commands          The run-time commands (things like ':set ...',\n                      ':color ...', etc.) is all contained here.\n\n    e_commands        All code for each of the e-commands (vitunes -e CMD ...)\n                      is here.  Used exclusively in vitunes.c.\n\n    vitunes           The \"main\" program.  In normal mode, does setup of media-\n                      library, user interface, and main input loop.\n                      Also contains all of the code for all of the e-commands\n                      (things like \"vitunes -e update\").\n\n\n---\n\nHope this helps anyone interested in hacking on vitunes (specifically me... 6\nmonths from now)\n\n-Ryan Flannery  \u003cryan.flannery@gmail.com\u003e  2 Jan. 2011\n                   (Checked for accuracy)  1 Jan. 2012\n\n\nReferences:\n   [1]   http://developer.kde.org/~wheeler/taglib.html\n   [2]   http://www.mplayerhq.hu/\n\n\nCURRENT LIST OF BIG \"TODO\"'s:\n\n*  Fix sorting of `meta_info`'s so that numeric fields are sorted by their\n   numeric values rather than character representations. This would require\n   some re-working.\n\n*  Sorting of `meta_info`'s: perhaps I could add some magic to ignore a starting\n   \"The\" or \"A\" from the sorting?  I dunno about this... I kinda like it the\n   way that it is.\n\n*  Original idea was to make the media player used be more general, so that it\n   wasn't specific to mplayer.  Still working on this.  Goal is to have it\n   setup so that one could do `vitunes -m /path/to/player` and the player\n   would communicate through stdin/stdout (using a pipe to vitunes) in a\n   unified way.  That way, the player could be a simple shell script that\n   would allow 1. using different players, 2. using different players for\n   different media types, and 3. making vitunes even more general... e.g.\n   could launch an image viewer for images, or an image viewer for images in\n   the meta info of a song.  Dunno.  Still working the details of this out.\n   Could provide a shell script \"wrapper\" around multiple players/viewers.\n\n*  Update from using 8-color curses API to 256-API.\n   -\u003e complicated... wtf!?!?  I thought the [n]curses API was supposed to make\n      this easy?\n\n:q\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanflannery%2Fvitunes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanflannery%2Fvitunes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanflannery%2Fvitunes/lists"}