aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-8/+1
| | | | | | | | | | | | | This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* storedPlaylist: remove the needless StoredPlaylist struct and just use ListEric Wong2008-01-011-8/+8
| | | | | | | | | | | Abstractions should reduce the amount of code and make things easier to follow. The StoredPlaylist struct did not do that, so get rid of it and just use our standard linked list implementation instead. diffstat agrees with me that the abstraction is pointless: 3 files changed, 60 insertions(+), 90 deletions(-) git-svn-id: https://svn.musicpd.org/mpd/trunk@7120 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* storedPlaylist: cleanup API and avoid needless heap allocations + error checksEric Wong2008-01-011-8/+10
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7119 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* playlist: cleanup pathname generation for the "rm" command, tooEric Wong2008-01-011-15/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7117 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* playlist: avoid the use of newStoredPlaylist for saving active playlistsEric Wong2008-01-011-6/+52
| | | | | | It was a nice way to double the memory needed to write the playlist to a file. git-svn-id: https://svn.musicpd.org/mpd/trunk@7116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread-safety work in preparation for rewrite to use pthreads Expect no regressions against trunk (r7078), possibly minor performance improvements in update (due to fewer heap allocations), but increased stack usage. Applied the following patches: * maxpath_str for reentrancy (temporary fix, reverted) * path: start working on thread-safe variants of these methods * Re-entrancy work on path/character-set conversions * directory.c: exploreDirectory() use reentrant functions here * directory/update: more use of reentrant functions + cleanups * string_toupper: a strdup-less version of strDupToUpper * get_song_url: a static-variable-free version of getSongUrl() * Use reentrant/thread-safe get_song_url everywhere * replace rmp2amp with the reentrant version, rmp2amp_r * Get rid of the non-reentrant/non-thread-safe rpp2app, too. * buffer2array: assert strdup() returns a usable value in unit tests * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants * fix storing playlists w/o absolute paths * parent_path(), a reentrant version of parentPath() * parentPath => parent_path for reentrancy and thread-safety * allow "make test" to automatically run embedded unit tests * remove convStrDup() and maxpath_str() * use MPD_PATH_MAX everywhere instead of MAXPATHLEN * path: get rid of appendSlash, pfx_path and just use pfx_dir * get_song_url: fix the ability to play songs in the top-level music_directory git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* If clearing stored playlist fails, don't return error + OK. but only the error.Qball Cow2007-12-271-2/+1
| | | | | | this was caused by always having the handleStoredPlaylist function return 0. git-svn-id: https://svn.musicpd.org/mpd/trunk@7105 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Playlist queue patch (http://musicpd.org/mantis/view.php?id=1478) version 11.Qball Cow2007-09-261-1/+172
| | | | | | | | | | | | | This adds the following commands: * queueid <id> Add song <id> to the queue. * dequeue <pos> Remove song from <pos> from the queue * queueinfo List the queue To the statusfield it adds the following entry: playlistqueue: <uid> UID can be used by clients to track changes in the playlist queue. git-svn-id: https://svn.musicpd.org/mpd/trunk@6927 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* conf: improved boolean config parameter handling from -keEric Wong2007-09-051-5/+5
| | | | | | the force flag will issue FATAL() if an invalid value is specified git-svn-id: https://svn.musicpd.org/mpd/trunk@6857 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't kill the player process (and effectively the decode process) whenJ. Alexander Treuman2007-06-041-2/+2
| | | | | | completely stopped. Instead, send them SIGSTOP to pause the process until they're needed again. Then send them SIGCONT instead of re-spawning them. git-svn-id: https://svn.musicpd.org/mpd/trunk@6485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Making some bool options more consistent.J. Alexander Treuman2007-06-031-2/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Tell the player process (and thus also the decode process) to quit whenJ. Alexander Treuman2007-06-011-3/+2
| | | | | | | | | | playback is stopped completely. This means the player process will no longer have to wake up 100 times per second to see if it's been told to start playing (the main process will just spawn a new player process when it needs to). On the downside, this means an extra pair of forks() and the re-initializing of the player and decode processes each time playback is restarted. git-svn-id: https://svn.musicpd.org/mpd/trunk@6446 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Minor formatting cleanups.J. Alexander Treuman2007-06-011-2/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6444 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman2007-05-261-2/+1
| | | | | call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleaning up addToStoredPlaylist. Now we call freeJustSong if adding a URL.J. Alexander Treuman2007-05-261-9/+18
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6269 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make sure StoredPlaylists always contain UTF-8 paths that are eitherJ. Alexander Treuman2007-05-261-3/+1
| | | | | | | | | | | | | | | | | | | | | | relative paths in the DB or URLs. The main functional difference is that playlistmove and playlistdelete will rewrite playlists in the correct encoding and remove invalid lines instead of potentially modifying them. The specific changes are: appendSongToStoredPlaylist: * Don't convert to FS charset * Don't prepend music_directory if saving absolute paths writeStoredPlaylistToPath: * Convert to FS charset * Prepend music_directory if saving absolute paths loadStoredPlaylist: * Make sure each line is either in the DB or a URL loadPlaylist: * Don't bother checking paths, since it's done in loadStoredPlaylist now git-svn-id: https://svn.musicpd.org/mpd/trunk@6266 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Committing pat's rewrite of the stored playlist code. This also adds twoJ. Alexander Treuman2007-05-161-277/+56
| | | | | new commands: playlistmove and playlistdelete. git-svn-id: https://svn.musicpd.org/mpd/trunk@6116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Typo.J. Alexander Treuman2007-04-081-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5889 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Doing those previous SONG_* commits properly. Thanks to normalperson forJ. Alexander Treuman2007-03-201-2/+2
| | | | | pointing it out. git-svn-id: https://svn.musicpd.org/mpd/trunk@5673 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use SONG_FILE instead of literal "file: " for consistency with db code.J. Alexander Treuman2007-03-201-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding playlistfind and playlistsearch commands for searching the currentJ. Alexander Treuman2007-02-241-0/+33
| | | | | playlist. git-svn-id: https://svn.musicpd.org/mpd/trunk@5420 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix for bug #1447Warren Dukes2007-02-181-6/+20
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* More sparse fixes now that we've re-enabled -Wmissing-prototypesEric Wong2007-01-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5260 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-3/+3
| | | | | | | | Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Remove a line of dead codeQball Cow2007-01-111-2/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5235 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use the existing define for the default value of save_absolute_playlistsJ. Alexander Treuman2006-12-231-1/+1
| | | | | instead of a hardcoded value. git-svn-id: https://svn.musicpd.org/mpd/trunk@5151 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding functions for clearing/adding to stored playlists. Commands to makeJ. Alexander Treuman2006-11-201-0/+102
| | | | | use of these functions are still being worked on. git-svn-id: https://svn.musicpd.org/mpd/trunk@5075 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-11/+11
| | | | | | | | | | | | | | | | | | | I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix warnings for -Wmissing-prototypesAvuton Olrich2006-08-201-8/+8
| | | | | | Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Revert leaks from r4311, and also the leak fixes as a result of thatEric Wong2006-08-141-12/+2
| | | | | | | | | | | | | | | | | | | | | | utf8ToFsCharset() and fsCharsetToUtf8() got very broken in r4311, and resulted in several commits to fix those leaks. Unfortunately, not all of those newly introduced leaks were fixed, nor was the result pretty. Also, fixed a double-free in lsPlaylists(). This is very hard to trigger (and therefore exploit) at the moment because we check printDirectoryInfo() beforehand. Intended behavior for utf8ToFsCharset() and fsCharsetToUtf8() as God^H^H^Hshank originally intended is now documented in path.h to prevent future errors like this. mpd could still use some good valgrind testing before the 0.12.0 release. <plug>In addition to reducing heap fragmentation, malloc reductions from mpd-ke greatly reduces the chance of leaks from happening due to programming errors.</plug> git-svn-id: https://svn.musicpd.org/mpd/trunk@4639 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Standardize state_file handling routines.Eric Wong2006-07-301-179/+103
| | | | | This way it's easier to manage and extend. git-svn-id: https://svn.musicpd.org/mpd/trunk@4494 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove deprecated myfprintf wrapperEric Wong2006-07-301-13/+14
| | | | | | | This shaves another 5-6k because we've removed the paranoid fflush() calls after every fprintf. Now we only fflush() when we need to git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* commandError() cleanups, fixup gcc checksEric Wong2006-07-301-4/+3
| | | | | | | stripped binary size reduced by 9k on my machine from making commandError a function. We'll print out error messages slightly slower before, but the smaller binary is more than worth it. git-svn-id: https://svn.musicpd.org/mpd/trunk@4488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* interface/connection malloc reductions from mpd-keEric Wong2006-07-301-122/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch massively reduces the amount of heap allocations at the interface/command layer. Most commands with minimal output should not allocate memory from the heap at all. Things like repeatedly polling status, currentsong, and volume changes should be faster as a result, and more importantly, not a source of memory fragmentation. These changes should be safe in that there's no way for a remote-client to corrupt memory or otherwise do bad stuff to MPD, but an extra set of eyes to review would be good. Of course there's never any warranty :) No longer do we use FILE * structures in the interface, which means we don't have to allocate any new memory for most connections. Now, before you go on about losing the buffering that FILE * +implies+, remember that myfprintf() never took advantage of any of the stdio buffering features. To reduce the diff and make bugs easier to spot in the diff, I've kept myfprintf in places where we write to files (and not network interfaces). Expect myfprintf to go away entirely soon (we'll use fprintf for writing regular files). git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use AudioCompress for volume normalizationJ. Alexander Treuman2006-07-271-9/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4474 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix a memory leak when removing a playlistJ. Alexander Treuman2006-07-211-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4422 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Remember kids: always test your code before committingJ. Alexander Treuman2006-07-211-5/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4420 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make getBoolConfigParam and save_absolute_paths_in_playlist less stupidJ. Alexander Treuman2006-07-211-1/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use getBoolConfigParam for save_absolute_paths_in_playlistJ. Alexander Treuman2006-07-211-14/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4418 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-1/+5
| | | | | | Add a few new options for indent to try to make things a bit cleaner git-svn-id: https://svn.musicpd.org/mpd/trunk@4411 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-623/+709
| | | | | | Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Sigh, another memory leakJ. Alexander Treuman2006-07-161-2/+7
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4374 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fixing what looks like a *huge* memory leakJ. Alexander Treuman2006-07-161-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fixing a whopping 4 memory leaksJ. Alexander Treuman2006-07-161-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4371 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* [CLEANUP] cleanup whitespace -> tabsAvuton Olrich2006-07-141-69/+66
| | | | | static where it makes sense git-svn-id: https://svn.musicpd.org/mpd/trunk@4344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Remove superfluous \n from addid's commandError call.J. Alexander Treuman2006-05-201-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4208 09075e82-0dd4-0310-85a5-a0d7c8717e4f