diff options
author | Christoph Heinrich <christoph.heinrich@student.tugraz.at> | 2023-08-31 04:28:30 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-09-13 22:47:59 +0000 |
commit | da400ed3a9b54408d1b5112855a7281380a1ef52 (patch) | |
tree | 0b3dab3749a674344046b95f7a01c0e268da0eac /TOOLS | |
parent | 5100e7acbabd52b7ebc996e1c73df059e7664018 (diff) | |
download | mpv-da400ed3a9b54408d1b5112855a7281380a1ef52.tar.bz2 mpv-da400ed3a9b54408d1b5112855a7281380a1ef52.tar.xz |
TOOLS/lua/autoload: add directory_mode option
This option behaves the same as the builtin one, and if it's value
is anything other then recursive|lazy|ignore it will fall back on the
builtin one as a sort of "auto" mode. It defaults to that auto mode.
Diffstat (limited to 'TOOLS')
-rw-r--r-- | TOOLS/lua/autoload.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index 6b854a8155..77f5c14bae 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -21,6 +21,7 @@ additional_video_exts=list,of,ext additional_audio_exts=list,of,ext ignore_hidden=yes same_type=yes +directory_mode=recursive --]] @@ -40,7 +41,8 @@ o = { additional_video_exts = "", additional_audio_exts = "", ignore_hidden = true, - same_type = false + same_type = false, + directory_mode = "auto" } options.read_options(o, nil, function(list) split_option_exts(list.additional_video_exts, list.additional_audio_exts, list.additional_image_exts) @@ -49,6 +51,9 @@ options.read_options(o, nil, function(list) list.images or list.additional_image_exts then create_extensions() end + if list.directory_mode then + validate_directory_mode() + end end) function Set (t) @@ -98,6 +103,13 @@ function create_extensions() end create_extensions() +function validate_directory_mode() + if o.directory_mode ~= "recursive" and o.directory_mode ~= "lazy" and o.directory_mode ~= "ignore" then + o.directory_mode = nil + end +end +validate_directory_mode() + function add_files(files) local oldcount = mp.get_property_number("playlist-count", 1) for i = 1, #files do @@ -244,7 +256,7 @@ function find_and_add_entries() local files = {} do - local dir_mode = mp.get_property("directory-mode") + local dir_mode = o.directory_mode or mp.get_property("directory-mode", "lazy") local separator = mp.get_property_native("platform") == "windows" and "\\" or "/" scan_dir(autoloaded_dir, path, dir_mode, separator, 0, files) end |