summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-17 21:16:10 +0200
committerwm4 <wm4@nowhere>2015-05-17 21:16:10 +0200
commitf4c412a0578d7448640eb8000876196f51299f13 (patch)
tree2b5611d19088ef535f52cef46e0be2a80183f748
parentaa78dff42b1dc6bbc6b6aa836e42341015ce164a (diff)
downloadmpv-f4c412a0578d7448640eb8000876196f51299f13.tar.bz2
mpv-f4c412a0578d7448640eb8000876196f51299f13.tar.xz
command: add playlist_shuffle command
Fixes #965.
-rw-r--r--DOCS/man/input.rst4
-rw-r--r--input/cmd_list.c1
-rw-r--r--input/cmd_list.h1
-rw-r--r--player/command.c5
4 files changed, 11 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index a7d620d82a..d23727e898 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -246,6 +246,10 @@ List of Input Commands
because index2 refers to the target entry, not the index the entry
will have after moving.)
+``playlist_shuffle``
+ Shuffle the playlist. This is similar to what is done on start if the
+ ``--shuffle`` option is used.
+
``run "command" "arg1" "arg2" ...``
Run the given command. Unlike in MPlayer/mplayer2 and earlier versions of
mpv (0.2.x and older), this doesn't call the shell. Instead, the command
diff --git a/input/cmd_list.c b/input/cmd_list.c
index e1c471a932..e7918f26d6 100644
--- a/input/cmd_list.c
+++ b/input/cmd_list.c
@@ -89,6 +89,7 @@ const struct mp_cmd_def mp_cmds[] = {
OARG_CHOICE(0, ({"weak", 0},
{"force", 1})),
}},
+ { MP_CMD_PLAYLIST_SHUFFLE, "playlist_shuffle", },
{ MP_CMD_SUB_STEP, "sub_step", { ARG_INT }, .allow_auto_repeat = true },
{ MP_CMD_SUB_SEEK, "sub_seek", { ARG_INT }, .allow_auto_repeat = true },
{ MP_CMD_OSD, "osd", { OARG_INT(-1) } },
diff --git a/input/cmd_list.h b/input/cmd_list.h
index e9418d4429..86f24f2edb 100644
--- a/input/cmd_list.h
+++ b/input/cmd_list.h
@@ -54,6 +54,7 @@ enum mp_command_type {
MP_CMD_PLAYLIST_CLEAR,
MP_CMD_PLAYLIST_REMOVE,
MP_CMD_PLAYLIST_MOVE,
+ MP_CMD_PLAYLIST_SHUFFLE,
MP_CMD_SUB_STEP,
MP_CMD_SUB_SEEK,
MP_CMD_TV_LAST_CHANNEL,
diff --git a/player/command.c b/player/command.c
index 9fbe6fd694..c03e63d254 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4483,6 +4483,11 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
break;
}
+ case MP_CMD_PLAYLIST_SHUFFLE: {
+ playlist_shuffle(mpctx->playlist);
+ break;
+ }
+
case MP_CMD_STOP:
playlist_clear(mpctx->playlist);
mpctx->stop_play = PT_STOP;