From 23067399cf4e6a70cc7bcc829a32b8079b739f66 Mon Sep 17 00:00:00 2001 From: unmem Date: Wed, 7 Jul 2021 13:24:46 +0800 Subject: [PATCH] Move config path to "script-opts" --- {script-settings => script-opts}/Blackbox.conf.example | 0 {script-settings => script-opts}/Colorbox.conf.example | 0 {script-settings => script-opts}/Leapfrog.conf.example | 0 {script-settings => script-opts}/README.md | 2 +- scripts/Blackbox.js | 2 +- scripts/Leapfrog.js | 2 +- scripts/modules.js/Options.js | 5 ++++- 7 files changed, 7 insertions(+), 4 deletions(-) rename {script-settings => script-opts}/Blackbox.conf.example (100%) rename {script-settings => script-opts}/Colorbox.conf.example (100%) rename {script-settings => script-opts}/Leapfrog.conf.example (100%) rename {script-settings => script-opts}/README.md (87%) diff --git a/script-settings/Blackbox.conf.example b/script-opts/Blackbox.conf.example similarity index 100% rename from script-settings/Blackbox.conf.example rename to script-opts/Blackbox.conf.example diff --git a/script-settings/Colorbox.conf.example b/script-opts/Colorbox.conf.example similarity index 100% rename from script-settings/Colorbox.conf.example rename to script-opts/Colorbox.conf.example diff --git a/script-settings/Leapfrog.conf.example b/script-opts/Leapfrog.conf.example similarity index 100% rename from script-settings/Leapfrog.conf.example rename to script-opts/Leapfrog.conf.example diff --git a/script-settings/README.md b/script-opts/README.md similarity index 87% rename from script-settings/README.md rename to script-opts/README.md index 218cef6..cc0df4c 100644 --- a/script-settings/README.md +++ b/script-opts/README.md @@ -1,7 +1,7 @@ ## Script Configurations This folder contains example configuration files. To enable them on your own -system, simply create the `script-settings/` folder in your mpv config path, +system, simply create the `script-opts/` folder in your mpv config path, exactly as shown here (side by side with your `scripts/` folder). The configurations automatically follow the `.conf` format, diff --git a/scripts/Blackbox.js b/scripts/Blackbox.js index 083c2bf..f631c5e 100644 --- a/scripts/Blackbox.js +++ b/scripts/Blackbox.js @@ -794,7 +794,7 @@ Blackbox.prototype.switchMenu = function(forcePage) (function() { // Read user configuration (uses defaults for any unconfigured options). // * You can override these values via the configuration system, as follows: - // - Via permanent file: `/script-settings/Blackbox.conf` + // - Via permanent file: `/script-opts/Blackbox.conf` // - Command override: `mpv --script-opts=Blackbox-favorites="{/path1}+{/path2}"` // - Or by editing this file directly (not recommended, makes your updates harder). var userConfig = new Options.advanced_options({ diff --git a/scripts/Leapfrog.js b/scripts/Leapfrog.js index 76b48c4..4e6f223 100644 --- a/scripts/Leapfrog.js +++ b/scripts/Leapfrog.js @@ -176,7 +176,7 @@ Leapfrog.prototype.jump = function(offset, rawOptions) (function() { // Read user configuration (uses defaults for any unconfigured options). // * You can override these values via the configuration system, as follows: - // - Via permanent file: `/script-settings/Leapfrog.conf` + // - Via permanent file: `/script-opts/Leapfrog.conf` // - Command override: `mpv --script-opts=Leapfrog-font_size=16` // - Or by editing this file directly (not recommended, makes your updates harder). var userConfig = new Options.advanced_options({ diff --git a/scripts/modules.js/Options.js b/scripts/modules.js/Options.js index 5600832..0ee2f35 100644 --- a/scripts/modules.js/Options.js +++ b/scripts/modules.js/Options.js @@ -65,7 +65,10 @@ var ScriptConfig = function(options, identifier) // Find config file. if (this.scriptName && this.scriptName.length) { mp.msg.debug('Reading options for '+this.scriptName+'.'); - this.configFile = mp.find_config_file('script-settings/'+this.scriptName+'.conf'); + this.configFile = mp.find_config_file('script-opts/'+this.scriptName+'.conf'); + + if (!this.configFile) // Try legacy settings location as fallback. + this.configFile = mp.find_config_file('script-settings/'+this.scriptName+'.conf'); if (!this.configFile) // Try legacy settings location as fallback. this.configFile = mp.find_config_file('lua-settings/'+this.scriptName+'.conf'); }