From ec45950b36de5577e90db309bd9f0f66e62a26ab Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Thu, 7 Dec 2006 14:41:40 +0000 Subject: Oops, forgot to add an interface to stored playlist editing. Here it is. git-svn-id: https://svn.musicpd.org/mpd/trunk@5128 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/command.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/command.c b/src/command.c index f1b98a9f3..1f37cfda6 100644 --- a/src/command.c +++ b/src/command.c @@ -92,6 +92,8 @@ #define COMMAND_DEVICES "outputs" #define COMMAND_COMMANDS "commands" #define COMMAND_NOTCOMMANDS "notcommands" +#define COMMAND_PLAYLISTCLEAR "playlistclear" +#define COMMAND_PLAYLISTADD "playlistadd" #define COMMAND_STATUS_VOLUME "volume" #define COMMAND_STATUS_STATE "state" @@ -917,6 +919,22 @@ static int handleNotcommands(int fd, int *permission, int argc, char *argv[]) return 0; } +static int handlePlaylistClear(int fd, int *permission, int argc, char *argv[]) +{ + return clearStoredPlaylist(fd, argv[1]); +} + +static int handlePlaylistAdd(int fd, int *permission, int argc, char *argv[]) +{ + char *playlist = argv[1]; + char *path = argv[2]; + + if (isRemoteUrl(path)) + return addToStoredPlaylist(fd, path, playlist); + + return addAllInToStoredPlaylist(fd, path, playlist); +} + void initCommands(void) { commandList = makeList(free, 1); @@ -976,6 +994,8 @@ void initCommands(void) addCommand(COMMAND_DEVICES, PERMISSION_READ, 0, 0, handleDevices, NULL); addCommand(COMMAND_COMMANDS, PERMISSION_NONE, 0, 0, handleCommands, NULL); addCommand(COMMAND_NOTCOMMANDS, PERMISSION_NONE, 0, 0, handleNotcommands, NULL); + addCommand(COMMAND_PLAYLISTCLEAR, PERMISSION_CONTROL, 1, 1, handlePlaylistClear, NULL); + addCommand(COMMAND_PLAYLISTADD, PERMISSION_CONTROL, 2, 2, handlePlaylistAdd, NULL); sortList(commandList); } -- cgit v1.2.3