diff options
author | wm4 <wm4@nowhere> | 2014-05-22 21:28:20 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-05-22 21:28:20 +0200 |
commit | cb2e784c075bed1a3220cf46dc072171f4f632e5 (patch) | |
tree | 7af1a7d821fd092d29fba55293ee86c1adf996da | |
parent | aca4f9f474bfc7d3775a68d4838b0263e27c377b (diff) | |
download | mpv-cb2e784c075bed1a3220cf46dc072171f4f632e5.tar.bz2 mpv-cb2e784c075bed1a3220cf46dc072171f4f632e5.tar.xz |
player: give quit_watch_later an exit code argument like quit
The quit command has an optional argument that is used as exit code.
Extend that to the quit_watch_later command. Actually, unify the
implementations of the two commands.
Requested in #798.
-rw-r--r-- | DOCS/man/en/input.rst | 7 | ||||
-rw-r--r-- | input/cmd_list.c | 2 | ||||
-rw-r--r-- | player/command.c | 9 |
3 files changed, 8 insertions, 10 deletions
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst index ad8edc5885..28518cc475 100644 --- a/DOCS/man/en/input.rst +++ b/DOCS/man/en/input.rst @@ -242,11 +242,12 @@ List of Input Commands shell script, and call that with ``run``. ``quit [<code>]`` - Exit the player using the given exit code. + Exit the player. If an argument is given, it's used as process exit code. -``quit_watch_later`` +``quit_watch_later [<code>]`` Exit player, and store current playback position. Playing that file later - will seek to the previous position on start. + will seek to the previous position on start. The (optional) argument is + exactly as in the ``quit`` command. ``sub_add "<file>"`` Load the given subtitle file. It is not selected as current subtitle after diff --git a/input/cmd_list.c b/input/cmd_list.c index 447e49376a..101ffbf0a8 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -70,7 +70,7 @@ const struct mp_cmd_def mp_cmds[] = { }, { MP_CMD_REVERT_SEEK, "revert_seek", }, { MP_CMD_QUIT, "quit", { OARG_INT(0) } }, - { MP_CMD_QUIT_WATCH_LATER, "quit_watch_later", }, + { MP_CMD_QUIT_WATCH_LATER, "quit_watch_later", { OARG_INT(0) } }, { MP_CMD_STOP, "stop", }, { MP_CMD_FRAME_STEP, "frame_step", .allow_auto_repeat = true }, { MP_CMD_FRAME_BACK_STEP, "frame_back_step", .allow_auto_repeat = true }, diff --git a/player/command.c b/player/command.c index 5e09079866..be5d215300 100644 --- a/player/command.c +++ b/player/command.c @@ -3242,17 +3242,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; case MP_CMD_QUIT: + case MP_CMD_QUIT_WATCH_LATER: + if (cmd->id == MP_CMD_QUIT_WATCH_LATER) + mp_write_watch_later_conf(mpctx); mpctx->stop_play = PT_QUIT; mpctx->quit_custom_rc = cmd->args[0].v.i; mpctx->has_quit_custom_rc = true; break; - case MP_CMD_QUIT_WATCH_LATER: - mp_write_watch_later_conf(mpctx); - mpctx->stop_play = PT_QUIT; - mpctx->quit_player_rc = 0; - break; - case MP_CMD_PLAYLIST_NEXT: case MP_CMD_PLAYLIST_PREV: { |