diff options
author | wm4 <wm4@nowhere> | 2015-02-16 22:06:41 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-02-16 22:08:16 +0100 |
commit | d26ba961d05a2de165fa87c41d705ed3db00231b (patch) | |
tree | eb3dfc217322ca600decad7a6bf7a051c6d521f5 /player/command.c | |
parent | 37183532ae2b3b919540a31f56d0089cd16652d9 (diff) | |
download | mpv-d26ba961d05a2de165fa87c41d705ed3db00231b.tar.bz2 mpv-d26ba961d05a2de165fa87c41d705ed3db00231b.tar.xz |
command: add rescan_external_files
Requested.
Hopefully will be useful for things that download and add external
subtitles on demand. Or something.
Closes #1586.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index 484b8d7aad..e2a69fe808 100644 --- a/player/command.c +++ b/player/command.c @@ -4636,6 +4636,24 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) return -1; } + case MP_CMD_RESCAN_EXTERNAL_FILES: { + if (!mpctx->playing) + return -1; + autoload_external_files(mpctx); + if (cmd->args[0].v.i) { + // somewhat fuzzy and not ideal + struct track *a = select_track(mpctx, STREAM_AUDIO, opts->audio_id, + opts->audio_id_ff, opts->audio_lang); + if (a && a->is_external) + mp_switch_track(mpctx, STREAM_AUDIO, a); + struct track *s = select_track(mpctx, STREAM_SUB, opts->sub_id, + opts->sub_id_ff, opts->sub_lang); + if (s && s->is_external) + mp_switch_track(mpctx, STREAM_SUB, s); + } + break; + } + case MP_CMD_SCREENSHOT: screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i, msg_osd); break; |