aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2007-05-26Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman1-2/+1
call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26Cleaning up addToStoredPlaylist. Now we call freeJustSong if adding a URL.J. Alexander Treuman1-9/+18
git-svn-id: https://svn.musicpd.org/mpd/trunk@6269 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26Make sure StoredPlaylists always contain UTF-8 paths that are eitherJ. Alexander Treuman1-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
2007-05-16Committing pat's rewrite of the stored playlist code. This also adds twoJ. Alexander Treuman1-277/+56
new commands: playlistmove and playlistdelete. git-svn-id: https://svn.musicpd.org/mpd/trunk@6116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-08Typo.J. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5889 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-20Doing those previous SONG_* commits properly. Thanks to normalperson forJ. Alexander Treuman1-2/+2
pointing it out. git-svn-id: https://svn.musicpd.org/mpd/trunk@5673 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-20Use SONG_FILE instead of literal "file: " for consistency with db code.J. Alexander Treuman1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@5669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-24Adding playlistfind and playlistsearch commands for searching the currentJ. Alexander Treuman1-0/+33
playlist. git-svn-id: https://svn.musicpd.org/mpd/trunk@5420 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-18fix for bug #1447Warren Dukes1-6/+20
git-svn-id: https://svn.musicpd.org/mpd/trunk@5369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14More sparse fixes now that we've re-enabled -Wmissing-prototypesEric Wong1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5260 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14Don't initialize globals to zero (or NULL)Eric Wong1-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
2007-01-11Remove a line of dead codeQball Cow1-2/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5235 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-12-23Use the existing define for the default value of save_absolute_playlistsJ. Alexander Treuman1-1/+1
instead of a hardcoded value. git-svn-id: https://svn.musicpd.org/mpd/trunk@5151 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-11-20Adding functions for clearing/adding to stored playlists. Commands to makeJ. Alexander Treuman1-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
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-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
2006-08-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-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
2006-08-14Revert leaks from r4311, and also the leak fixes as a result of thatEric Wong1-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
2006-07-30Standardize state_file handling routines.Eric Wong1-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
2006-07-30remove deprecated myfprintf wrapperEric Wong1-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
2006-07-30commandError() cleanups, fixup gcc checksEric Wong1-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
2006-07-30interface/connection malloc reductions from mpd-keEric Wong1-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
2006-07-27Use AudioCompress for volume normalizationJ. Alexander Treuman1-9/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@4474 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-21Fix a memory leak when removing a playlistJ. Alexander Treuman1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@4422 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-21Remember kids: always test your code before committingJ. Alexander Treuman1-5/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@4420 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-21Make getBoolConfigParam and save_absolute_paths_in_playlist less stupidJ. Alexander Treuman1-1/+8
git-svn-id: https://svn.musicpd.org/mpd/trunk@4419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-21Use getBoolConfigParam for save_absolute_paths_in_playlistJ. Alexander Treuman1-14/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@4418 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20Add mpd-indent.shAvuton Olrich1-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
2006-07-20Add mpd-indent.shAvuton Olrich1-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
2006-07-17sparse: ANSI-fy function declarationsEric Wong1-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
2006-07-16Sigh, another memory leakJ. Alexander Treuman1-2/+7
git-svn-id: https://svn.musicpd.org/mpd/trunk@4374 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-16Fixing what looks like a *huge* memory leakJ. Alexander Treuman1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-16Fixing a whopping 4 memory leaksJ. Alexander Treuman1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@4371 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14[CLEANUP] cleanup whitespace -> tabsAvuton Olrich1-69/+66
static where it makes sense git-svn-id: https://svn.musicpd.org/mpd/trunk@4344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-20Remove superfluous \n from addid's commandError call.J. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4208 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-08Commit Jat's patch for bug 1282Qball Cow1-3/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@4137 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-08Commit Jat's patch for bug 1281Qball Cow1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4136 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-23Adding of plchangesposid command, this is a stripped down version of the ↵Qball Cow1-0/+20
plchanges command, it only sends the pos and id of the changed command. Libmpd allready has support for it, and libmpdclient in libmpd too git-svn-id: https://svn.musicpd.org/mpd/trunk@4101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-26src/playlist.c: remove unnecessary strdup()Eric Wong1-4/+5
Yes, I know about what I said on IRC earlier, but this is an allocation + free inside a loop. git-svn-id: https://svn.musicpd.org/mpd/trunk@3953 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-26Small fix, it's file: test not file:testQball Cow1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@3948 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-26Support for fetching the content of a stored playlist (patch by qball), this ↵Qball Cow1-73/+106
adds listPlaylist and listPlaylistInfo git-svn-id: https://svn.musicpd.org/mpd/trunk@3947 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-08for windows compatibility, if we're unable to add a song, convert '\' to '/' ↵Warren Dukes1-4/+14
and try again to add the file git-svn-id: https://svn.musicpd.org/mpd/trunk@3036 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-06fix stateFile path getting garbledWarren Dukes1-18/+28
git-svn-id: https://svn.musicpd.org/mpd/trunk@3029 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11implement saved memory by not storing full pathWarren Dukes1-16/+11
git-svn-id: https://svn.musicpd.org/mpd/trunk@2601 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02new command "addid", this is the same as "add" command, except it also ↵Warren Dukes1-6/+12
returns the songid of the added song. Note that "addid" does not work on directories git-svn-id: https://svn.musicpd.org/mpd/trunk@2487 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02oops, a typo, but that's ok, i'm still da manWarren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@2468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02a few extra strerror()'s sprinkled in the codeWarren Dukes1-2/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@2467 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-30use random() instead of rand()Warren Dukes1-4/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@2420 09075e82-0dd4-0310-85a5-a0d7c8717e4f