mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 06:42:03 +00:00
lua: add option to disable auto-loading of lua scripts
This commit is contained in:
parent
47ede0f5e3
commit
1e2d409fb4
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user