aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-22 19:16:56 +0200
committerMax Kellermann <max@duempel.org>2008-10-22 19:16:56 +0200
commit9c983c442c03a71bbf80ccbf1dad84894403a983 (patch)
treed8c8750ad5c0bcc76eef92f0260b33f1da99cc76 /src/command.c
parentf8e586402d2b3c70fa0f28fc3ad6e542128e5562 (diff)
downloadmpd-9c983c442c03a71bbf80ccbf1dad84894403a983.tar.gz
mpd-9c983c442c03a71bbf80ccbf1dad84894403a983.tar.xz
mpd-9c983c442c03a71bbf80ccbf1dad84894403a983.zip
command: added command "listplaylists"
"listplaylists" returns a list of all stored playlists. This command seems more elaborate than listing them below "lsinfo".
Diffstat (limited to '')
-rw-r--r--src/command.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index dbdbe4003..db793350d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1157,6 +1157,22 @@ static int handlePlaylistAdd(struct client *client,
}
static int
+handle_list_playlists(struct client *client,
+ mpd_unused int argc, mpd_unused char *argv[])
+{
+ GPtrArray *list = spl_list();
+ if (list == NULL) {
+ command_error(client, ACK_ERROR_SYSTEM,
+ "failed to get list of stored playlists");
+ return -1;
+ }
+
+ print_spl_list(client, list);
+ spl_list_free(list);
+ return 0;
+}
+
+static int
handle_idle(struct client *client,
mpd_unused int argc, mpd_unused char *argv[])
{
@@ -1194,6 +1210,7 @@ static const struct command commands[] = {
{ "listallinfo", PERMISSION_READ, 0, 1, handleListAllInfo },
{ "listplaylist", PERMISSION_READ, 1, 1, handleListPlaylist },
{ "listplaylistinfo", PERMISSION_READ, 1, 1, handleListPlaylistInfo },
+ { "listplaylists", PERMISSION_READ, 0, 0, handle_list_playlists },
{ "load", PERMISSION_ADD, 1, 1, handleLoad },
{ "lsinfo", PERMISSION_READ, 0, 1, handleLsInfo },
{ "move", PERMISSION_CONTROL, 2, 2, handleMove },