diff options
author | J. Alexander Treuman <jat@spatialrift.net> | 2006-12-07 14:41:40 +0000 |
---|---|---|
committer | J. Alexander Treuman <jat@spatialrift.net> | 2006-12-07 14:41:40 +0000 |
commit | ec45950b36de5577e90db309bd9f0f66e62a26ab (patch) | |
tree | 20160e92e1f0278130f4de883a3ccfe0fa2bb702 /src | |
parent | 63dd4b45983babdf1703b320526aed48a87ca45e (diff) | |
download | mpd-ec45950b36de5577e90db309bd9f0f66e62a26ab.tar.gz mpd-ec45950b36de5577e90db309bd9f0f66e62a26ab.tar.xz mpd-ec45950b36de5577e90db309bd9f0f66e62a26ab.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 20 |
1 files changed, 20 insertions, 0 deletions
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); } |