From b60817f9ddd3acdc92fafd10633ef73c274235a3 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Mon, 5 Dec 2016 21:09:28 +0000 Subject: 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 --- TOOLS/lua/autoload.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'TOOLS') 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) -- cgit v1.2.3