From e7630722d81c1cd36042d0b1368407a92e488742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Tue, 4 Jun 2024 12:32:28 +0200 Subject: [PATCH] autoload.lua: always accept current file as a valid file This allows loading other types of media from the current directory, with same_type=no, regardless of whether the current type is enabled for autoload. Fixes: #14287 --- TOOLS/lua/autoload.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index 172924e409..dedfc64e85 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -243,13 +243,15 @@ local function scan_dir(path, current_file, dir_mode, separator, dir_depth, tota end filter(files, function(v) - -- The current file could be a hidden file, ignoring it doesn't load other - -- files from the current directory. + -- Always accept current file local current = prefix .. v == current_file - if o.ignore_hidden and not current and v:match("^%.") then + if current then + return true + end + if o.ignore_hidden and v:match("^%.") then return false end - if not current and is_ignored(v) then + if is_ignored(v) then return false end @@ -308,8 +310,7 @@ local function find_and_add_entries() local pl_count = mp.get_property_number("playlist-count", 1) local this_ext = get_extension(filename) -- check if this is a manually made playlist - if (pl_count > 1 and autoloaded == nil) or - (pl_count == 1 and EXTENSIONS[this_ext:lower()] == nil) then + if pl_count > 1 and autoloaded == nil then msg.debug("stopping: manually made playlist") return elseif pl_count == 1 then @@ -360,6 +361,7 @@ local function find_and_add_entries() end end if not current then + msg.debug("current file not found in directory") return end msg.trace("current file position in files: "..current)