summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2024-01-11 00:43:12 +0100
committerDudemanguy <random342@airmail.cc>2024-02-04 15:12:02 +0000
commite2284fba180fe33f399835f1d1afdb7871ebef4c (patch)
tree0cba505e6304fae08c155de9027b401b61a80e51 /player/command.c
parent27cb193f0e87014fbf5121e34da462b46975e53c (diff)
downloadmpv-e2284fba180fe33f399835f1d1afdb7871ebef4c.tar.bz2
mpv-e2284fba180fe33f399835f1d1afdb7871ebef4c.tar.xz
command: add load-config-file
Unlike set include mpv.conf, this works after playback has started. It can be used to auto reload the configuration, e.g. in vim: autocmd BufWritePost ~/.config/mpv/mpv.conf silent !echo load-config-file %:p | socat - /tmp/mpvsocket Partially fixes #6362.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 57e3b793de..1ad7868a7f 100644
--- a/player/command.c
+++ b/player/command.c
@@ -55,6 +55,7 @@
#include "options/m_option.h"
#include "options/m_property.h"
#include "options/m_config_frontend.h"
+#include "options/parse_configfile.h"
#include "osdep/getpid.h"
#include "video/out/gpu/context.h"
#include "video/out/vo.h"
@@ -6270,6 +6271,23 @@ static void cmd_apply_profile(void *p)
}
}
+static void cmd_load_config_file(void *p)
+{
+ struct mp_cmd_ctx *cmd = p;
+ struct MPContext *mpctx = cmd->mpctx;
+
+ char *config_file = cmd->args[0].v.s;
+ int r = m_config_parse_config_file(mpctx->mconfig, mpctx->global,
+ config_file, NULL, 0);
+
+ if (r < 1) {
+ cmd->success = false;
+ return;
+ }
+
+ mp_notify_property(mpctx, "profile-list");
+}
+
static void cmd_load_script(void *p)
{
struct mp_cmd_ctx *cmd = p;
@@ -6807,6 +6825,8 @@ const struct mp_cmd_def mp_cmds[] = {
.flags = MP_CMD_OPT_ARG}, }
},
+ { "load-config-file", cmd_load_config_file, {{"filename", OPT_STRING(v.s)}} },
+
{ "load-script", cmd_load_script, {{"filename", OPT_STRING(v.s)}} },
{ "dump-cache", cmd_dump_cache, { {"start", OPT_TIME(v.d),