From eabd2ac9e45849301c46af6b668215f4ab26aa98 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 21 Apr 2015 19:09:44 +0200 Subject: TOOLS/autoload: add blank lines for readability --- TOOLS/lua/autoload.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index bbc33def63..4610a38589 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -24,6 +24,7 @@ function find_and_add_entries() if #dir == 0 then return end + local files = mputils.readdir(dir, "files") if files == nil then return @@ -31,9 +32,11 @@ function find_and_add_entries() table.sort(files, function (a, b) return string.lower(a) < string.lower(b) end) + if dir == "." then dir = "" end + local pl = mp.get_property_native("playlist", {}) local pl_current = mp.get_property_number("playlist-pos", 0) + 1 -- Find the current pl entry (dir+"/"+filename) in the sorted dir list @@ -47,6 +50,7 @@ function find_and_add_entries() if current == nil then return end + local append = {[-1] = {}, [1] = {}} for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1 for i = 1, MAXENTRIES do @@ -55,6 +59,7 @@ function find_and_add_entries() if file == nil or file[1] == "." then break end + local filepath = dir .. file if pl_e then -- If there's a playlist entry, and it's the same file, stop. @@ -62,6 +67,7 @@ function find_and_add_entries() break end end + if direction == -1 then if pl_current == 1 then -- never add additional entries in the middle mp.msg.info("Prepending " .. file) @@ -73,6 +79,7 @@ function find_and_add_entries() end end end + add_files_at(pl_current + 1, append[1]) add_files_at(pl_current, append[-1]) end -- cgit v1.2.3