diff options
author | Max Kellermann <max@duempel.org> | 2008-10-22 17:23:11 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-22 17:23:11 +0200 |
commit | 1da921f03cc3063dc309d0e1afdcd41e201f55a2 (patch) | |
tree | 9662e1635b2404a429fc0b725716ac7efa40d9c5 | |
parent | ac853b6165f8c9b0caa414d4c7182715e28152f6 (diff) | |
download | mpd-1da921f03cc3063dc309d0e1afdcd41e201f55a2.tar.gz mpd-1da921f03cc3063dc309d0e1afdcd41e201f55a2.tar.xz mpd-1da921f03cc3063dc309d0e1afdcd41e201f55a2.zip |
stored_playlist: moved functions from playlist.c
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.
-rw-r--r-- | src/playlist.c | 28 | ||||
-rw-r--r-- | src/playlist.h | 4 | ||||
-rw-r--r-- | src/stored_playlist.c | 22 | ||||
-rw-r--r-- | src/stored_playlist.h | 4 |
4 files changed, 26 insertions, 32 deletions
diff --git a/src/playlist.c b/src/playlist.c index 9244b8554..c8974595d 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -218,11 +218,6 @@ void clearPlaylist(void) incrPlaylistVersion(); } -int clearStoredPlaylist(const char *utf8file) -{ - return spl_clear(utf8file); -} - void showPlaylist(struct client *client) { int i; @@ -575,29 +570,6 @@ enum playlist_result addToPlaylist(const char *url, int *added_id) return addSongToPlaylist(song, added_id); } -int addToStoredPlaylist(const char *url, const char *utf8file) -{ - struct song *song; - - DEBUG("add to stored playlist: %s\n", url); - - song = db_get_song(url); - if (song) - return spl_append_song(utf8file, song); - - if (!isValidRemoteUtf8Url(url)) - return ACK_ERROR_NO_EXIST; - - song = song_remote_new(url); - if (song) { - int ret = spl_append_song(utf8file, song); - song_free(song); - return ret; - } - - return ACK_ERROR_NO_EXIST; -} - enum playlist_result addSongToPlaylist(struct song *song, int *added_id) { diff --git a/src/playlist.h b/src/playlist.h index e104a48e2..6aa5325c0 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -71,8 +71,6 @@ void savePlaylistState(FILE *); void clearPlaylist(void); -int clearStoredPlaylist(const char *utf8file); - /** * Appends a local file (outside the music database) to the playlist, * but only if the file's owner is equal to the specified uid. @@ -82,8 +80,6 @@ playlist_append_file(const char *path, int uid, int *added_id); enum playlist_result addToPlaylist(const char *file, int *added_id); -int addToStoredPlaylist(const char *file, const char *utf8file); - enum playlist_result addSongToPlaylist(struct song *song, int *added_id); diff --git a/src/stored_playlist.c b/src/stored_playlist.c index 8b3b5de2c..1a8d64e5c 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -25,6 +25,7 @@ #include "ls.h" #include "database.h" #include "idle.h" +#include "ack.h" #include "os_compat.h" static ListNode * @@ -316,6 +317,27 @@ spl_append_song(const char *utf8path, struct song *song) return PLAYLIST_RESULT_SUCCESS; } +int addToStoredPlaylist(const char *url, const char *utf8file) +{ + struct song *song; + + song = db_get_song(url); + if (song) + return spl_append_song(utf8file, song); + + if (!isValidRemoteUtf8Url(url)) + return ACK_ERROR_NO_EXIST; + + song = song_remote_new(url); + if (song) { + int ret = spl_append_song(utf8file, song); + song_free(song); + return ret; + } + + return ACK_ERROR_NO_EXIST; +} + enum playlist_result spl_rename(const char *utf8from, const char *utf8to) { diff --git a/src/stored_playlist.h b/src/stored_playlist.h index 4f02833f1..7d2ebf301 100644 --- a/src/stored_playlist.h +++ b/src/stored_playlist.h @@ -33,12 +33,16 @@ spl_move_index(const char *utf8path, int src, int dest); enum playlist_result spl_clear(const char *utf8path); +#define clearStoredPlaylist spl_clear + enum playlist_result spl_remove_index(const char *utf8path, int pos); enum playlist_result spl_append_song(const char *utf8path, struct song *song); +int addToStoredPlaylist(const char *file, const char *utf8file); + enum playlist_result spl_rename(const char *utf8from, const char *utf8to); |