summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mpv.rst3
-rw-r--r--DOCS/man/en/options.rst4
-rw-r--r--options/options.c2
-rw-r--r--options/options.h1
-rw-r--r--player/lua.c2
5 files changed, 11 insertions, 1 deletions
diff --git a/DOCS/man/en/mpv.rst b/DOCS/man/en/mpv.rst
index fc17e759f0..39e33f75c0 100644
--- a/DOCS/man/en/mpv.rst
+++ b/DOCS/man/en/mpv.rst
@@ -603,7 +603,8 @@ FILES
``~/.mpv/lua/``
All files in this directly are loaded as if they were passed to the
``--lua`` option. They are loaded in alphabetical order, and sub-directories
- and files with no ``.lua`` extension are ignored.
+ and files with no ``.lua`` extension are ignored. The ``--load-scripts=no``
+ option disables loading these files.
EXAMPLES OF MPV USAGE
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index ca887eccfb..6461750062 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1286,6 +1286,10 @@ OPTIONS
``--list-properties``
Print a list of the available properties.
+``--load-scripts=<yes|no>``
+ If set to ``no``, don't auto-load scripts from ``~/.mpv/lua/``.
+ (Default: ``yes``)
+
``--load-unsafe-playlists``
Normally, something like ``mpv playlist.m3u`` won't load the playlist. This
is because the playlist code is unsafe. (This is the same in all other
diff --git a/options/options.c b/options/options.c
index d777fac215..202fb42c49 100644
--- a/options/options.c
+++ b/options/options.c
@@ -245,6 +245,7 @@ const m_option_t mp_opts[] = {
OPT_STRINGLIST("lua", lua_files, CONF_GLOBAL),
OPT_KEYVALUELIST("lua-opts", lua_opts, M_OPT_GLOBAL),
OPT_FLAG("osc", lua_load_osc, CONF_GLOBAL),
+ OPT_FLAG("load-scripts", auto_load_scripts, CONF_GLOBAL),
#endif
// ------------------------- stream options --------------------
@@ -696,6 +697,7 @@ const struct MPOpts mp_default_opts = {
.osd_scale = 1,
.osd_scale_by_window = 1,
.lua_load_osc = 1,
+ .auto_load_scripts = 1,
.loop_times = -1,
.ordered_chapters = 1,
.chapter_merge_threshold = 100,
diff --git a/options/options.h b/options/options.h
index daa6ab6fc5..23be601f46 100644
--- a/options/options.h
+++ b/options/options.h
@@ -55,6 +55,7 @@ typedef struct MPOpts {
char **lua_files;
char **lua_opts;
int lua_load_osc;
+ int auto_load_scripts;
struct m_obj_settings *audio_driver_list, *ao_defs;
int fixed_vo;
diff --git a/player/lua.c b/player/lua.c
index e12a5f533e..e66f8e514e 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -1060,6 +1060,8 @@ void mp_lua_init(struct MPContext *mpctx)
if (files[n][0])
mp_lua_load_script(mpctx, files[n]);
}
+ if (!mpctx->opts->auto_load_scripts)
+ return;
// Load ~/.mpv/lua/*
void *tmp = talloc_new(NULL);
char *lua_path = mp_find_user_config_file(tmp, mpctx->global, "lua");