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
This commit is contained in:
Ricardo Constantino
2016-12-05 21:09:28 +00:00
parent ceb2e1026d
commit b60817f9dd

View File

@@ -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)