aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorRomain Bignon <romain@peerfuse.org>2009-02-13 10:38:32 +0100
committerMax Kellermann <max@duempel.org>2009-02-13 10:43:30 +0100
commit9fe459f62581be39228dfbd69c1151df04fb6abe (patch)
tree18bcaacf8c814e249ede958c30a4f2a5db424549 /src/command.c
parentbeaf860a17eeae561c5e197274533b72b8f5398c (diff)
downloadmpd-9fe459f62581be39228dfbd69c1151df04fb6abe.tar.gz
mpd-9fe459f62581be39228dfbd69c1151df04fb6abe.tar.xz
mpd-9fe459f62581be39228dfbd69c1151df04fb6abe.zip
added the shufflerange command
This command shuffles a range of songs.
Diffstat (limited to '')
-rw-r--r--src/command.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/command.c b/src/command.c
index e6401896d..42ea87f77 100644
--- a/src/command.c
+++ b/src/command.c
@@ -656,7 +656,12 @@ static enum command_return
handle_shuffle(G_GNUC_UNUSED struct client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{
- shufflePlaylist(&g_playlist);
+ unsigned start = 0, end = queue_length(&g_playlist.queue);
+ if (argc == 2 && !check_range(client, &start, &end,
+ argv[1], need_range))
+ return COMMAND_RETURN_ERROR;
+
+ shufflePlaylist(&g_playlist, start, end);
return COMMAND_RETURN_OK;
}
@@ -1566,7 +1571,7 @@ static const struct command commands[] = {
{ "seek", PERMISSION_CONTROL, 2, 2, handle_seek },
{ "seekid", PERMISSION_CONTROL, 2, 2, handle_seekid },
{ "setvol", PERMISSION_CONTROL, 1, 1, handle_setvol },
- { "shuffle", PERMISSION_CONTROL, 0, 0, handle_shuffle },
+ { "shuffle", PERMISSION_CONTROL, 0, 1, handle_shuffle },
{ "stats", PERMISSION_READ, 0, 0, handle_stats },
{ "status", PERMISSION_READ, 0, 0, handle_status },
#ifdef ENABLE_SQLITE