From 1da921f03cc3063dc309d0e1afdcd41e201f55a2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Oct 2008 17:23:11 +0200 Subject: 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. --- src/stored_playlist.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/stored_playlist.c') 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) { -- cgit v1.2.3