aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-04-28 20:25:07 +0200
committerMax Kellermann <max@duempel.org>2009-04-28 20:25:07 +0200
commit61b083551265c78110855e79b5f12adcd422affb (patch)
tree705eeff7aa3bba81f84a5032e83312e7c59b47fb
parent610940a06dc09fc14581cffc2829358e926ec9c3 (diff)
downloadmpd-61b083551265c78110855e79b5f12adcd422affb.tar.gz
mpd-61b083551265c78110855e79b5f12adcd422affb.tar.xz
mpd-61b083551265c78110855e79b5f12adcd422affb.zip
command: added "sticker delete" command
Diffstat (limited to '')
-rw-r--r--doc/protocol.xml18
-rw-r--r--src/command.c22
2 files changed, 40 insertions, 0 deletions
diff --git a/doc/protocol.xml b/doc/protocol.xml
index 953012b12..3379fc568 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -1273,6 +1273,24 @@ OK
</para>
</listitem>
</varlistentry>
+ <varlistentry id="command_sticker_delete">
+ <term>
+ <cmdsynopsis>
+ <command>sticker</command>
+ <arg choice="plain">delete</arg>
+ <arg choice="req"><replaceable>TYPE</replaceable></arg>
+ <arg choice="req"><replaceable>URI</replaceable></arg>
+ <arg choice="opt"><replaceable>NAME</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Deletes a sticker value from the specified object. If
+ you do not specify a sticker name, all sticker values
+ are deleted.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry id="command_sticker_list">
<term>
<cmdsynopsis>
diff --git a/src/command.c b/src/command.c
index 1290a34e7..d30b63594 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1589,6 +1589,28 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
}
return COMMAND_RETURN_OK;
+ } else if ((argc == 4 || argc == 5) &&
+ strcmp(argv[1], "delete") == 0) {
+ struct song *song;
+ bool ret;
+
+ song = db_get_song(argv[3]);
+ if (song == NULL) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "no such song");
+ return COMMAND_RETURN_ERROR;
+ }
+
+ ret = argc == 4
+ ? sticker_song_delete(song)
+ : sticker_song_delete_value(song, argv[4]);
+ if (!ret) {
+ command_error(client, ACK_ERROR_SYSTEM,
+ "no such sticker");
+ return COMMAND_RETURN_ERROR;
+ }
+
+ return COMMAND_RETURN_OK;
} else if (argc == 5 && strcmp(argv[1], "find") == 0) {
/* "sticker find song a/directory name" */
struct directory *directory;