diff options
-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); |