aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-05-26 15:00:38 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-05-26 15:00:38 +0000
commitd14a6559018e89d593a5576611eceda9f3b341b0 (patch)
tree2535035114e3495fa8a6c2fab97b416bcbdf3339 /src/playlist.c
parentf16e3728711c3dd4fd2ca241ddbe3df4499d754e (diff)
downloadmpd-d14a6559018e89d593a5576611eceda9f3b341b0.tar.gz
mpd-d14a6559018e89d593a5576611eceda9f3b341b0.tar.xz
mpd-d14a6559018e89d593a5576611eceda9f3b341b0.zip
Cleaning up addToStoredPlaylist. Now we call freeJustSong if adding a URL.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6269 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 5536dcf8d..390cae8b9 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -586,17 +586,26 @@ int addToStoredPlaylist(int fd, char *url, char *utf8file)
DEBUG("add to stored playlist: %s\n", url);
- if ((song = getSongFromDB(url))) {
- } else if (!(isValidRemoteUtf8Url(url) &&
- (song = newSong(url, SONG_TYPE_URL, NULL)))) {
- commandError(fd, ACK_ERROR_NO_EXIST,
- "\"%s\" is not in the music db or is "
- "not a valid url", url);
- return -1;
+ song = getSongFromDB(url);
+ if (song) {
+ appendSongToStoredPlaylistByPath(fd, utf8file, song);
+ return 0;
}
- appendSongToStoredPlaylistByPath(fd, utf8file, song);
- return 0;
+ if (!isValidRemoteUtf8Url(url))
+ goto fail;
+
+ song = newSong(url, SONG_TYPE_URL, NULL);
+ if (song) {
+ appendSongToStoredPlaylistByPath(fd, utf8file, song);
+ freeJustSong(song);
+ return 0;
+ }
+
+fail:
+ commandError(fd, ACK_ERROR_NO_EXIST, "\"%s\" is not in the music db"
+ "or is not a valid url", url);
+ return -1;
}
int addSongToPlaylist(int fd, Song * song, int printId)