aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-10-14mapper: new song-to-filesystem mapper libraryMax Kellermann1-0/+1
The mapper library maps directory and song objects to file system paths. With this central library, the code mixture in path.c should be cleaned up, and we will be able to add neat features like aliasing.
2008-10-14playlist: moved code to playlist_save.cMax Kellermann1-12/+3
playlist_print_song() and playlist_print_uri() handle charset conversion and (optional) music directory prefixing.
2008-10-13playlist: don't use isPlaylist() in deletePlaylist()Max Kellermann1-4/+3
The only caller of deletePlaylist() appends PLAYLIST_FILE_SUFFIX, so we can be sure it's already there. We don't need to stat the file, since unlink() does all the checking.
2008-10-12player: added commands QUEUE and CANCELMax Kellermann1-45/+4
QUEUE adds a new song to the player's queue. CANCEL clears the queue. These two commands replace the old and complex queueState and queueLockState code.
2008-10-12playlist: call clearPlayerQueue() only if song is queuedMax Kellermann1-23/+15
Simplify and merge several if clauses before the clearPlayerQueue() invocation. Call clearPlayerQueue() only if a song is actually queued; add an assertion for that in clearPlayerQueue().
2008-10-09database: renamed get_get_song() to db_get_song()Max Kellermann1-3/+3
Search'n'replace typo..
2008-10-08database: renamed functions, "db_" prefix and no CamelCaseMax Kellermann1-3/+3
Yet another CamelCase removal patch.
2008-10-08directory: moved code to database.cMax Kellermann1-1/+1
Taming the directory.c monster, part II: move the database management stuff to database. directory.c should only contain code which works on directory objects.
2008-10-08song: removed CamelCaseMax Kellermann1-16/+16
CamelCase is ugly... rename all functions.
2008-10-08song: replaced all song constructorsMax Kellermann1-2/+2
Provide separate constructors for creating a remote song, a local song, and one for loading data from a song file. This way, we can add more assertions.
2008-10-08playlist: simplified setPlaylistRandomStatus()Max Kellermann1-16/+15
Check the old status before assigning. This saves a temporary variable.
2008-10-08use the "bool" data type instead of "int"Max Kellermann1-13/+13
"bool" should be used in C99 programs for boolean values.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-10/+13
Again, a data type which can be forward-declared.
2008-10-07song: replace printSong* with song_print_*Eric Wong1-2/+2
This make argument order more consistent for iterators. Additionally, these now return ssize_t results for error checking.
2008-10-06song: stop storing song_typeEric Wong1-7/+7
We already know if a song is a URL or not based on whether it has parentDir defined or not. Hopefully one day in the future we can drop HTTP support from MPD entirely when an HTTP filesystem comes along and we can access streams via open(2).
2008-09-29switch to C99 types, part IIMax Kellermann1-4/+4
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
2008-09-29playlist: deleteASongFromPlaylist takes a const Song *Eric Wong1-1/+1
We don't change the song pointer there, either.
2008-09-23start using prefixcmp()Eric Wong1-23/+8
LOC reduction and less noise makes things easier for tired old folks to follow.
2008-09-07playlist: replaced song_id_exists() with song_id_to_position()Max Kellermann1-16/+29
Since all callers of song_id_exists() will map it to a song position after the check, introduce a new function called song_id_to_position() which performs both the check and the map lookup, including nice assertions.
2008-09-07playlist: don't pass "fd" to showPlaylist(), playlistChangesPosId()Max Kellermann1-7/+6
Pass the client struct instead of the raw file descriptor.
2008-09-07playlist: added playlist_save()Max Kellermann1-2/+11
The shared code in showPlaylist() isn't worth it, because we aim to remove fdprintf(). Duplicate this small function, and enable stdio buffering for saved playlists.
2008-09-07playlist: pass struct client to loadPlaylist()Max Kellermann1-3/+3
The function loadPlaylist() wants to report incremental errors to the client, for this reason we cannot remove its protocol dependency right now. Instead, make it use the client struct instead of the raw file descriptor.
2008-09-07pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann1-16/+19
Don't pass the raw file descriptor around. This migration patch is rather large, because all of the sources have inter dependencies - we have to change all of them at the same time.
2008-09-07playlist: PlaylistInfo() does not call commandError()Max Kellermann1-4/+1
Continuing the effort of removing protocol specific calls from the core libraries: let the command.c code call commandError() based on PlaylistInfo's return value.
2008-09-07playlist: don't pass "fd" to storedPlaylist.c functionsMax Kellermann1-33/+17
Return an "enum playlist_result" value instead of calling commandError() in storedPlaylist.c.
2008-09-07playlist: don't pass "fd" to playlist.c functionsMax Kellermann1-131/+90
The playlist library shouldn't talk to the client if possible. Introduce the "enum playlist_result" type which the caller (i.e. command.c) may use to generate an error message.
2008-09-07playlist: showPlaylist() and shufflePlaylist() cannot failMax Kellermann1-6/+2
Make them both return void.
2008-09-07playlist: moved "repeat" and "random" value checks to command.cMax Kellermann1-20/+6
Client's input values should be validated by the command implementation, and the core libraries shouldn't talk to the client directly if possible. Thus, setPlaylistRepeatStatus() and setPlaylistRandomStatus() don't get the file descriptor, and cannot fail (return void).
2008-09-07playlist: added is_valid_playlist_name()Max Kellermann1-3/+8
The function valid_playlist_name() checks the name, but it insists on reporting an eventual error to the client. The new function is_valid_playlist_name() is more generic: it just returns a boolean, and does not care what the caller will use it for. The old function valid_playlist_name() will be removed later.
2008-09-07song: moved code to song_print.c, song_save.cMax Kellermann1-0/+1
Move everything which dumps song information (via tag_print.c) to a separate source file. song_print.c gets code which writes song data to the client; song_save.c is responsible for serializing songs from the tag cache.
2008-09-06dbUtils, playlist, directory: pass constant pointersMax Kellermann1-7/+7
The usual bunch of const pointer conversions.
2008-08-29tag: renamed functions, no CamelCaseMax Kellermann1-3/+3
2008-08-26renamed player.c to player_control.cMax Kellermann1-1/+1
Give player.c a better name, meaning that the code is used to control the player thread.
2008-08-26no commandError() in playerSeek()Max Kellermann1-2/+6
We should avoid having protocol specific code in player.c. Just return success or failure, and let the caller send the error code to the MPD client.
2008-08-26don't initialize "i" if we overwrite it anywayMax Kellermann1-1/+3
2008-08-26removed the "queue" parameter from syncPlaylistWithQueue()Max Kellermann1-12/+11
There is only one caller which passes "true", so we can move the queueNextSongInPlaylist() invocation there.
2008-08-26merge the playlist lock functions into clearPlayerQueue()Max Kellermann1-24/+11
There is no unlocked caller of clearPlayerQueue(), and the functions lockPlaylistInteraction() and unlockPlaylistInteraction() are trivial - merge them.
2008-08-26use switch/case in syncPlaylistWithQueue()Max Kellermann1-8/+18
2008-08-26don't call playerStop() before playerPlay()Max Kellermann1-2/+0
Since playerPlay() already calls playerStop(), we can remove its invocation of playerStop() from playPlaylistOrderNumber(). We can also make playerStop a static function.
2008-08-26queueSong() cannot failMax Kellermann1-13/+3
All (indirect) callers of queueSong() ensure that the queue state is BLANK, so there is no need to check it in queueSong() again. As a side effect, queueSong() cannot fail anymore, and can return void. Also, playlist_queueError and all its error handling can go away.
2008-08-26added enum player_queue_stateMax Kellermann1-0/+6
2008-08-26playlist: eliminate unused fd parametersMax Kellermann1-37/+30
Again, remove file descriptor parameters, which are not actually used. These functions can also be converted to return void.
2008-08-26player: no "fd" and no return valueMax Kellermann1-14/+9
Most player*() functions do not actually use the file descriptor, and always return 0 (success). Eliminate them to get a leaner interface.
2008-08-26enable -Wpointer-arith, -Wstrict-prototypesMax Kellermann1-1/+1
Also enable -Wunused-parameter - this forces us to add the gcc "unused" attribute to a lot of parameters (mostly library callback functions), but it's worth it during code refactorizations.
2008-04-12clean up CPP includesMax Kellermann1-1/+2
Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12added clearPlayerQueueLocked()Max Kellermann1-43/+24
since clearPlayerQueue() is always called within lockPlaylistInteraction() / unlockPlaylistInteraction(), it simplifies the code to add another function which calls these three functions. git-svn-id: https://svn.musicpd.org/mpd/trunk@7253 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26fix strtok() related segmentation faultMax Kellermann1-1/+4
strtok() may return NULL if the input is an empty string. The playlist parser did not check for that. git-svn-id: https://svn.musicpd.org/mpd/trunk@7200 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26eliminated duplicate initializationMax Kellermann1-2/+2
Local variables which are never read before the first assignment don't need initialization. Saves a few bytes of text. Also don't reset variables which are never read until function return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26fix "unreachable code" warningMax Kellermann1-6/+0
There is unreachable code at several positions, e.g. after an #if/#end, or after an endless loop. Remove that. git-svn-id: https://svn.musicpd.org/mpd/trunk@7197 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26check the result of fopen() in all code pathsMax Kellermann1-0/+5
The while() loop only checks for interrupted system calls (which woudl never happen if the signal mask were set up properly), but nobody checks if the fopen() actually succeeds. git-svn-id: https://svn.musicpd.org/mpd/trunk@7195 09075e82-0dd4-0310-85a5-a0d7c8717e4f