aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-02 23:44:33 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-02 23:44:33 +0000
commitf468aba16e00aa003b28bd24a79c14cd07eefe3f (patch)
tree80646af809b96d90938b1fe6ab87abb01e2170c9 /src/command.c
parent78c5d884d2c687034d18e4cb77c7c116e1c97b84 (diff)
downloadmpd-f468aba16e00aa003b28bd24a79c14cd07eefe3f.tar.gz
mpd-f468aba16e00aa003b28bd24a79c14cd07eefe3f.tar.xz
mpd-f468aba16e00aa003b28bd24a79c14cd07eefe3f.zip
new command "addid", this is the same as "add" command, except it also returns the songid of the added song. Note that "addid" does not work on directories
git-svn-id: https://svn.musicpd.org/mpd/trunk@2487 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/command.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c
index d7d644cd0..6ccb51579 100644
--- a/src/command.c
+++ b/src/command.c
@@ -45,6 +45,7 @@
#define COMMAND_KILL "kill"
#define COMMAND_CLOSE "close"
#define COMMAND_ADD "add"
+#define COMMAND_ADDID "addid"
#define COMMAND_DELETE "delete"
#define COMMAND_DELETEID "deleteid"
#define COMMAND_PLAYLIST "playlist"
@@ -298,11 +299,17 @@ int handleAdd(FILE * fp, unsigned int * permission, int argArrayLength,
if(argArrayLength == 2) {
path = argArray[1];
- if(isRemoteUrl(path)) return addToPlaylist(fp,path);
+ if(isRemoteUrl(path)) return addToPlaylist(fp, path, 0);
}
return addAllIn(fp,path);
}
+int handleAddId(FILE * fp, unsigned int * permission, int argArrayLength,
+ char ** argArray)
+{
+ return addToPlaylist(fp, argArray[0], 1);
+}
+
int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
@@ -811,6 +818,7 @@ void initCommands() {
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill,NULL);
addCommand(COMMAND_CLOSE ,0, -1,-1,handleClose,NULL);
addCommand(COMMAND_ADD ,PERMISSION_ADD, 0, 1,handleAdd,NULL);
+ addCommand(COMMAND_ADDID ,PERMISSION_ADD, 0, 1,handleAddId,NULL);
addCommand(COMMAND_DELETE ,PERMISSION_CONTROL, 1, 1,handleDelete,NULL);
addCommand(COMMAND_DELETEID ,PERMISSION_CONTROL, 1, 1,handleDeleteId,NULL);
addCommand(COMMAND_PLAYLIST ,PERMISSION_READ, 0, 0,handlePlaylist,NULL);