diff options
author | wm4 <wm4@nowhere> | 2013-07-02 13:17:50 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-02 13:23:26 +0200 |
commit | 451f6788cea2f7a90badcf2fb7e1e3679fa513cb (patch) | |
tree | 3ed3098c30316d5d8c174da64359e4f873d8a0cf /core/command.c | |
parent | 0b77649c0b6afb103e0390163bd14f1cf9d20f06 (diff) | |
download | mpv-451f6788cea2f7a90badcf2fb7e1e3679fa513cb.tar.bz2 mpv-451f6788cea2f7a90badcf2fb7e1e3679fa513cb.tar.xz |
command: add some playlist manipulation commands
playlist_remove and playlist_move.
Diffstat (limited to 'core/command.c')
-rw-r--r-- | core/command.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/command.c b/core/command.c index 453ddbe974..dec3ae9c9f 100644 --- a/core/command.c +++ b/core/command.c @@ -2180,6 +2180,29 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; } + case MP_CMD_PLAYLIST_REMOVE: { + struct playlist_entry *e = playlist_entry_from_index(mpctx->playlist, + cmd->args[0].v.i); + if (e) { + // Can't play a removed entry + if (mpctx->playlist->current == e) + mpctx->stop_play = PT_CURRENT_ENTRY; + playlist_remove(mpctx->playlist, e); + } + break; + } + + case MP_CMD_PLAYLIST_MOVE: { + struct playlist_entry *e1 = playlist_entry_from_index(mpctx->playlist, + cmd->args[0].v.i); + struct playlist_entry *e2 = playlist_entry_from_index(mpctx->playlist, + cmd->args[1].v.i); + if (e1) { + playlist_move(mpctx->playlist, e1, e2); + } + break; + } + case MP_CMD_STOP: // Go back to the starting point. mpctx->stop_play = PT_STOP; |