mirror of
https://github.com/mpv-player/mpv
synced 2024-11-03 03:19:24 +01:00
command: provide per-file-options for loadfile command
Signed-off-by: wm4 <wm4@nowhere> Closes #575. Minor changes over original pull request.
This commit is contained in:
parent
f5c781b0d5
commit
bb6b543812
@ -122,6 +122,7 @@ const struct mp_cmd_def mp_cmds[] = {
|
||||
ARG_STRING,
|
||||
OARG_CHOICE(0, ({"replace", 0}, {"0", 0},
|
||||
{"append", 1}, {"1", 1})),
|
||||
OPT_KEYVALUELIST(ARG(str_list), 0),
|
||||
}},
|
||||
{ MP_CMD_LOADLIST, "loadlist", {
|
||||
ARG_STRING,
|
||||
|
@ -75,6 +75,7 @@ struct mp_cmd_arg {
|
||||
float f;
|
||||
double d;
|
||||
char *s;
|
||||
char **str_list;
|
||||
void *p;
|
||||
} v;
|
||||
};
|
||||
|
@ -2973,7 +2973,15 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
if (!append)
|
||||
playlist_clear(mpctx->playlist);
|
||||
|
||||
playlist_add(mpctx->playlist, playlist_entry_new(filename));
|
||||
struct playlist_entry *entry = playlist_entry_new(filename);
|
||||
if (cmd->args[2].v.str_list) {
|
||||
char **pairs = cmd->args[2].v.str_list;
|
||||
for (int i = 0; pairs[i] && pairs[i + 1]; i += 2) {
|
||||
playlist_entry_add_param(entry, bstr0(pairs[i]),
|
||||
bstr0(pairs[i + 1]));
|
||||
}
|
||||
}
|
||||
playlist_add(mpctx->playlist, entry);
|
||||
|
||||
if (!append)
|
||||
mp_set_playlist_entry(mpctx, mpctx->playlist->first);
|
||||
|
Loading…
Reference in New Issue
Block a user