aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* playlist: track song metadata changesMax Kellermann2008-11-111-12/+9
| | | | | When the tag of the current song changes (e.g. a new tag was sent in the stream), update the playlist, so clients pick up the new tag.
* path: moved playlist_dir to mapper.cMax Kellermann2008-10-311-3/+4
| | | | | Added the function map_spl_utf8_to_fs() which replaces utf8_to_fs_playlist_path().
* utils: use g_str_has_prefix() instead of prefixcmp()Max Kellermann2008-10-281-8/+8
| | | | Remove duplicated code from MPD.
* stored_playlist: renamed and moved spl_delete() to stored_playlist.cMax Kellermann2008-10-231-14/+0
| | | | The function deletePlaylist() shouldn't be in playlist.c.
* stored_playlist: spl_load() returns GPtrArrayMax Kellermann2008-10-231-16/+9
| | | | | Don't use our deprecated linked list library, use GLib's GPtrArray instead.
* playlist: unsigned integersMax Kellermann2008-10-231-129/+110
| | | | | | There are some integers which have a "magic" -1 value which means "undefined" or "nothing". All others can be converted to unsigned, since they must not contain a negative number.
* stored_playlist: moved functions from playlist.cMax Kellermann2008-10-221-28/+0
| | | | | | The two functions clearStoredPlaylist() and addToStoredPlaylist() don't belong into playlist.c. clearStoredPlaylist() was a wrapper for spl_clear(), and is converted into a CPP macro for now.
* stored_playlist: no CamelCaseMax Kellermann2008-10-221-5/+5
| | | | Renamed all public functions, prefix is "spl_".
* renamed storedPlaylist.c to stored_playlist.cMax Kellermann2008-10-221-1/+1
| | | | No CamelCase in file names.
* playlist: also allow world-readable local filesMax Kellermann2008-10-151-1/+1
| | | | | Allow a local user to not only add his own files, but also all world-readable files (mode 0444).
* playlist: added support for adding songs not in the music databaseMax Kellermann2008-10-151-0/+26
| | | | | Clients which have authenticated via unix socket may add local files to the MPD playlist, provided that they own the file.
* playlist: moved code to song_by_url()Max Kellermann2008-10-151-4/+17
| | | | | Replace some complicated checks from addToPlaylist() to the simpler function song_by_url().
* song: added song_in_database()Max Kellermann2008-10-151-8/+7
| | | | | | | Some functions assume that a song is not in the database when it is a remote song. Based on that, they decide whether they are responsible for freeing the song struct. Add a special function which checks whether a song is in the database (currently equal to song_is_file()).
* locate: use g_utf8_casefold() instead of string_toupper()Max Kellermann2008-10-151-2/+4
| | | | | | string_toupper() and strDupToUpper() were not able to deal with character sets other than US-ASCII. Use GLib's g_utf8_casefold() for strings.
* command: added command "idle"Max Kellermann2008-10-141-0/+10
| | | | | | "idle" waits until something noteworthy happens on the server, e.g. song change, playlist modified, database updated. This allows clients to keep up to date without polling.
* mapper: new song-to-filesystem mapper libraryMax Kellermann2008-10-141-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.
* playlist: moved code to playlist_save.cMax Kellermann2008-10-141-12/+3
| | | | | playlist_print_song() and playlist_print_uri() handle charset conversion and (optional) music directory prefixing.
* playlist: don't use isPlaylist() in deletePlaylist()Max Kellermann2008-10-131-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.
* player: added commands QUEUE and CANCELMax Kellermann2008-10-121-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.
* playlist: call clearPlayerQueue() only if song is queuedMax Kellermann2008-10-121-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().
* database: renamed get_get_song() to db_get_song()Max Kellermann2008-10-091-3/+3
| | | | Search'n'replace typo..
* database: renamed functions, "db_" prefix and no CamelCaseMax Kellermann2008-10-081-3/+3
| | | | Yet another CamelCase removal patch.
* directory: moved code to database.cMax Kellermann2008-10-081-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.
* song: removed CamelCaseMax Kellermann2008-10-081-16/+16
| | | | CamelCase is ugly... rename all functions.
* song: replaced all song constructorsMax Kellermann2008-10-081-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.
* playlist: simplified setPlaylistRandomStatus()Max Kellermann2008-10-081-16/+15
| | | | | Check the old status before assigning. This saves a temporary variable.
* use the "bool" data type instead of "int"Max Kellermann2008-10-081-13/+13
| | | | "bool" should be used in C99 programs for boolean values.
* song: converted typedef Song to struct songMax Kellermann2008-10-081-10/+13
| | | | Again, a data type which can be forward-declared.
* song: replace printSong* with song_print_*Eric Wong2008-10-071-2/+2
| | | | | | This make argument order more consistent for iterators. Additionally, these now return ssize_t results for error checking.
* song: stop storing song_typeEric Wong2008-10-061-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).
* switch to C99 types, part IIMax Kellermann2008-09-291-4/+4
| | | | | Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
* playlist: deleteASongFromPlaylist takes a const Song *Eric Wong2008-09-291-1/+1
| | | | We don't change the song pointer there, either.
* start using prefixcmp()Eric Wong2008-09-231-23/+8
| | | | | LOC reduction and less noise makes things easier for tired old folks to follow.
* playlist: replaced song_id_exists() with song_id_to_position()Max Kellermann2008-09-071-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.
* playlist: don't pass "fd" to showPlaylist(), playlistChangesPosId()Max Kellermann2008-09-071-7/+6
| | | | Pass the client struct instead of the raw file descriptor.
* playlist: added playlist_save()Max Kellermann2008-09-071-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.
* playlist: pass struct client to loadPlaylist()Max Kellermann2008-09-071-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.
* pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann2008-09-071-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.
* playlist: PlaylistInfo() does not call commandError()Max Kellermann2008-09-071-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.
* playlist: don't pass "fd" to storedPlaylist.c functionsMax Kellermann2008-09-071-33/+17
| | | | | Return an "enum playlist_result" value instead of calling commandError() in storedPlaylist.c.
* playlist: don't pass "fd" to playlist.c functionsMax Kellermann2008-09-071-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.
* playlist: showPlaylist() and shufflePlaylist() cannot failMax Kellermann2008-09-071-6/+2
| | | | Make them both return void.
* playlist: moved "repeat" and "random" value checks to command.cMax Kellermann2008-09-071-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).
* playlist: added is_valid_playlist_name()Max Kellermann2008-09-071-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.
* song: moved code to song_print.c, song_save.cMax Kellermann2008-09-071-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.
* dbUtils, playlist, directory: pass constant pointersMax Kellermann2008-09-061-7/+7
| | | | The usual bunch of const pointer conversions.
* tag: renamed functions, no CamelCaseMax Kellermann2008-08-291-3/+3
|
* renamed player.c to player_control.cMax Kellermann2008-08-261-1/+1
| | | | | Give player.c a better name, meaning that the code is used to control the player thread.
* no commandError() in playerSeek()Max Kellermann2008-08-261-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.
* don't initialize "i" if we overwrite it anywayMax Kellermann2008-08-261-1/+3
|