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.
This commit is contained in:
parent
ac853b6165
commit
1da921f03c
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue