summaryrefslogtreecommitdiffstats
path: root/player/scripting.c
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2014-12-15 01:31:30 +0200
committerwm4 <wm4@nowhere>2014-12-15 04:39:56 +0100
commit39e04e929483847a3e0722d86d53f69837ed99db (patch)
tree56901ce1b9d1cb35f05d3e059d2aca83319491ff /player/scripting.c
parent06828f71a134e0b880601665c0daea78e6523633 (diff)
downloadmpv-39e04e929483847a3e0722d86d53f69837ed99db.tar.bz2
mpv-39e04e929483847a3e0722d86d53f69837ed99db.tar.xz
options: deprecate 'lua' based options/dirs for 'script'
- --lua and --lua-opts change to --script and --script-opts - 'lua' default script dirs change to 'scripts' - DOCS updated - 'lua-settings' dir was _not_ modified The old lua-based names/dirs still work, but display a warning. Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'player/scripting.c')
-rw-r--r--player/scripting.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/player/scripting.c b/player/scripting.c
index f2ddcec2aa..2ad45075b0 100644
--- a/player/scripting.c
+++ b/player/scripting.c
@@ -179,7 +179,7 @@ void mp_load_scripts(struct MPContext *mpctx)
mp_load_script(mpctx, "@osc.lua");
if (mpctx->opts->lua_load_ytdl)
mp_load_script(mpctx, "@ytdl_hook.lua");
- char **files = mpctx->opts->lua_files;
+ char **files = mpctx->opts->script_files;
for (int n = 0; files && files[n]; n++) {
if (files[n][0])
mp_load_script(mpctx, files[n]);
@@ -187,13 +187,24 @@ void mp_load_scripts(struct MPContext *mpctx)
if (!mpctx->opts->auto_load_scripts)
return;
- // Load all lua scripts
+ // Load all scripts
void *tmp = talloc_new(NULL);
- char **luadir = mp_find_all_config_files(tmp, mpctx->global, "lua");
- for (int i = 0; luadir && luadir[i]; i++) {
- files = list_script_files(tmp, luadir[i]);
- for (int n = 0; files && files[n]; n++)
- mp_load_script(mpctx, files[n]);
+ const char *dirs[] = {"scripts", "lua", NULL}; // 'lua' is deprecated
+ int warning_displayed = 0;
+ for (int s = 0; dirs[s]; s++) {
+ char **scriptsdir = mp_find_all_config_files(tmp, mpctx->global, dirs[s]);
+ for (int i = 0; scriptsdir && scriptsdir[i]; i++) {
+ files = list_script_files(tmp, scriptsdir[i]);
+ for (int n = 0; files && files[n]; n++) {
+ if (s && !warning_displayed) {
+ warning_displayed = 1;
+ MP_WARN(mpctx,
+ "warning: '%s' - '%s' dirs are deprecated. Please move scripts to '%s'.",
+ files[n], dirs[s], dirs[0]);
+ }
+ mp_load_script(mpctx, files[n]);
+ }
+ }
}
talloc_free(tmp);
}