summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2016-12-05 21:09:28 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2016-12-05 21:09:28 +0000
commitb60817f9ddd3acdc92fafd10633ef73c274235a3 (patch)
treea70104fea564a94255b89b85b2590925fbee3e7c /TOOLS
parentceb2e1026d4295d3831d080dc18f8ca5db56bc5c (diff)
downloadmpv-b60817f9ddd3acdc92fafd10633ef73c274235a3.tar.bz2
mpv-b60817f9ddd3acdc92fafd10633ef73c274235a3.tar.xz
TOOLS/autoload: allow disabling through script-opts
This allows leaving autoload in auto-loaded scripts and to be used in a special profile like "pseudo-gui" without being troublesome to disable the behavior in profiles that get applied after pseudo-gui. Ex: [someprofile] script-opts=autoload-disabled=yes
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/lua/autoload.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua
index fa56a3de4c..5f8faa3ad2 100644
--- a/TOOLS/lua/autoload.lua
+++ b/TOOLS/lua/autoload.lua
@@ -7,6 +7,13 @@
-- Add at most 5000 * 2 files when starting a file (before + after).
MAXENTRIES = 5000
+local options = require 'mp.options'
+
+o = {
+ disabled = false
+}
+options.read_options(o)
+
function Set (t)
local set = {}
for _, v in pairs(t) do set[v] = true end
@@ -49,7 +56,7 @@ end
function find_and_add_entries()
local path = mp.get_property("path", "")
local dir, filename = mputils.split_path(path)
- if #dir == 0 then
+ if o.disabled or #dir == 0 then
return
end
local pl_count = mp.get_property_number("playlist-count", 1)