From bb6b543812a72484fe657f04ae5c050d353b7584 Mon Sep 17 00:00:00 2001 From: xylosper Date: Sat, 22 Feb 2014 15:28:05 +0900 Subject: command: provide per-file-options for loadfile command Signed-off-by: wm4 Closes #575. Minor changes over original pull request. --- input/cmd_list.c | 1 + input/input.h | 1 + player/command.c | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/input/cmd_list.c b/input/cmd_list.c index c5bfbc34aa..982d4f366c 100644 --- a/input/cmd_list.c +++ b/input/cmd_list.c @@ -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, diff --git a/input/input.h b/input/input.h index ee66ff6f8a..6e2e0f7046 100644 --- a/input/input.h +++ b/input/input.h @@ -75,6 +75,7 @@ struct mp_cmd_arg { float f; double d; char *s; + char **str_list; void *p; } v; }; diff --git a/player/command.c b/player/command.c index 2a40132a70..5f39817d46 100644 --- a/player/command.c +++ b/player/command.c @@ -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); -- cgit v1.2.3