aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* playlist: convert assertion to check in TAG event handlerMax Kellermann2009-01-211-2/+3
| | | | | | It is possible that playlist.current is reset before the TAG event handler playlist_tag_event() is called. Convert the assertion into a run-time check.
* command: don't restart player in the "status" commandMax Kellermann2009-01-211-1/+3
| | | | | | Don't attempt to restart the player if it was stopped, but there were still songs left on the playlist. This looks like it has been a workaround for a bug which has been fixed long time ago.
* playlist: use the "enum player_error" typeMax Kellermann2009-01-211-1/+1
| | | | Don't assign the result of getPlayerError() to an integer.
* playlist: free memory with g_free()Max Kellermann2009-01-211-10/+5
| | | | | Use g_free() consistently with g_malloc(). Don't clear the pointers after freeing them.
* use config_get_positive() instead of manual parsingMax Kellermann2009-01-211-12/+3
| | | | | Simplify some code by using config_get_positive(), instead of doing manual parsing and validation each time.
* event_pipe: added "TAG" eventMax Kellermann2009-01-201-28/+18
| | | | | | The "TAG" event is emitted by the player thread when the current song's tag has changed. Split this event from "PLAYLIST" and make it a separate callback, which is more efficient.
* mapper: make the playlist directory optionalMax Kellermann2009-01-181-0/+3
|
* conf: use config_get_bool() instead of getBoolConfigParam()Max Kellermann2009-01-171-7/+3
|
* conf: no CamelCase, part IMax Kellermann2009-01-171-2/+2
| | | | Renamed functions, types, variables.
* playlist: don't store getBoolConfigParam() in a boolMax Kellermann2009-01-161-3/+5
| | | | | | getBoolConfigParam() returns an int. It is not possible to check for CONF_BOOL_UNSET after it has been assigned to a bool; use a temporary int value for that.
* playlist: safely search the playlist for deleted songMax Kellermann2009-01-141-1/+1
| | | | | | | | When a song file is deleted during database update, all pointers to it must be removed from the playlist. The "for" loop in deleteASongFromPlaylist() did not deal with multiple copies of the deleted song properly, and left instances of the (to-be-invalidated) pointer in. Fix this by reversing the loop.
* playlist: implement Fisher-Yates shuffle properlyMax Kellermann2009-01-131-2/+2
| | | | | | | | MPD's shuffling algorithm was not implemented well: it considers songs which were already swapped, making it somewhat non-random. Fix the Fisher-Yates shuffle algorithm by passing the proper bounds to the PRNG.
* playlist: pass unsigned integers to playlistInfo()Max Kellermann2009-01-101-14/+6
| | | | | A song index cannot be negative. Also require the second parameter to be valid.
* playlist: exclude end of rangeMax Kellermann2009-01-101-1/+1
| | | | | In a range "start:end", "end" itself should not be included. Use the same semantics as other languages implementing ranges, e.g. Python.
* command: playlistinfo now uses a range argument rather than just a song idThomas Jansen2009-01-101-1/+6
| | | | | | | | | | | | | Loosely based on a patch provided by lesion in bug #1766. The playlistinfo command can now retrieve ranges of the playlist. The new argument indicates which entry is the last one that will be displayed. The number of displayed entries may be smaller than expected if the end of the playlist is reached. Previous usage: playlistinfo [start] New usage: playlistinfo [start[:end]]
* song: allocate the result of song_get_url()Max Kellermann2009-01-041-24/+28
|
* playlist: log errors during loadPlaylist()Max Kellermann2009-01-041-3/+2
| | | | | | Don't call command_error() if loading a song from the playlist fails. This may result in assertion failures, since command_error() may be called more than once.
* playlist: use GLib loggingMax Kellermann2009-01-041-21/+19
|
* playlist: use uri_has_scheme() instead of isRemoteUrl()Max Kellermann2009-01-041-1/+1
| | | | | | For internal checks (i.e. not in command.c), we need to check whether an URI is in the databse, in the local file system or a remote URI with a scheme.
* state_file: errors are non-fatal in read_state_file()Max Kellermann2009-01-031-12/+20
| | | | | If the state file cannot be read, for whatever reason, don't abort MPD. The state file isn't _that_ important.
* list: removed linked list libraryMax Kellermann2009-01-021-1/+0
| | | | It's been superseded by GLib's GSList.
* playlist: use GLib instead of utils.hMax Kellermann2009-01-021-11/+15
|
* playlist: use g_file_test() instead of stat()Max Kellermann2009-01-011-2/+1
| | | | | To find out whether a file exists, use g_file_test() instead of stat(), because it is more portable and easier to use.
* mapper: allocate playlist path from heapMax Kellermann2009-01-011-4/+6
| | | | Don't pass a static buffer to map_spl_utf8_to_fs().
* command: don't allow adding local files on WIN32Max Kellermann2008-12-301-0/+2
| | | | | | There are no unix sockets on WIN32, and therefore no authentication. WIN32 might have similar capabilities, but until we implement them, disable that MPD feature.
* playlist: use GLib's random number generatorMax Kellermann2008-12-301-7/+10
| | | | srandom() and random() are not portable. Use GLib's implementation.
* removed os_compat.hMax Kellermann2008-12-291-1/+6
| | | | | Only include headers which are really needed. os_compat.h aimed to make MPD easily portable, but was never actually made portable.
* utils: removed myFgets()Max Kellermann2008-12-281-4/+9
| | | | Replaced myFgets() with fgets() + g_strchomp().
* playlist: clear pc.errored_song on deleteMax Kellermann2008-12-171-2/+8
| | | | | When a (remote) song is deleted from the playlist, there may still be a reference to it in pc.errored_song. Clear this reference.
* ls: removed isValidRemoteUtf8Url()Max Kellermann2008-12-161-1/+1
| | | | | The function didn't do anything useful, it was just several lines obfuscating that it was only forwarding isRemoteUrl()'s return value.
* playlist: call clearPlayerQueue() only if song is queued IIMax Kellermann2008-11-121-14/+10
| | | | | This patch extends commit 35a16b99, and amends several 2 missing checks. It simplifies 2 more checks by merging "if" conditions.
* 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.