summaryrefslogtreecommitdiff
path: root/mpv/scripts/file-browser/modules/setup.lua
diff options
context:
space:
mode:
authorryukamish <[email protected]>2026-04-11 16:06:45 +0530
committerryukamish <[email protected]>2026-04-11 16:06:45 +0530
commit607891801fbf2051a0c9062d15a445dd238c1e1b (patch)
tree33b8cfba2355b498addea05e385b06d46cced30f /mpv/scripts/file-browser/modules/setup.lua
parent6fbde2906e3bb2d4d1df23f6374d8a6a0aef870f (diff)
add: mako and mpv configs
Diffstat (limited to 'mpv/scripts/file-browser/modules/setup.lua')
-rw-r--r--mpv/scripts/file-browser/modules/setup.lua60
1 files changed, 60 insertions, 0 deletions
diff --git a/mpv/scripts/file-browser/modules/setup.lua b/mpv/scripts/file-browser/modules/setup.lua
new file mode 100644
index 0000000..e68709d
--- /dev/null
+++ b/mpv/scripts/file-browser/modules/setup.lua
@@ -0,0 +1,60 @@
+local mp = require 'mp'
+
+local o = require 'modules.options'
+local g = require 'modules.globals'
+local fb_utils = require 'modules.utils'
+local fb = require 'modules.apis.fb'
+
+--sets up the compatible extensions list
+local function setup_extensions_list()
+ --setting up subtitle extensions
+ for ext in fb_utils.iterate_opt(o.subtitle_extensions:lower(), ',') do
+ g.sub_extensions[ext] = true
+ g.extensions[ext] = true
+ end
+
+ --setting up audio extensions
+ for ext in fb_utils.iterate_opt(o.audio_extensions:lower(), ',') do
+ g.audio_extensions[ext] = true
+ g.extensions[ext] = true
+ end
+
+ --adding file extensions to the set
+ for _, ext in ipairs(g.compatible_file_extensions) do
+ g.extensions[ext] = true
+ end
+
+ --adding extra extensions on the whitelist
+ for str in fb_utils.iterate_opt(o.extension_whitelist:lower(), ',') do
+ g.extensions[str] = true
+ end
+
+ --removing extensions that are in the blacklist
+ for str in fb_utils.iterate_opt(o.extension_blacklist:lower(), ',') do
+ g.extensions[str] = nil
+ end
+end
+
+--splits the string into a table on the separators
+local function setup_root()
+ for str in fb_utils.iterate_opt(o.root) do
+ local path = mp.command_native({'expand-path', str}) --[[@as string]]
+ path = fb_utils.fix_path(path, true)
+
+ local temp = {name = path, type = 'dir', label = str, ass = fb_utils.ass_escape(str, true)}
+
+ g.root[#g.root+1] = temp
+ end
+
+ if g.PLATFORM == 'windows' then
+ fb.register_root_item('C:/')
+ elseif g.PLATFORM ~= nil then
+ fb.register_root_item('/')
+ end
+end
+
+---@class setup
+return {
+ extensions_list = setup_extensions_list,
+ root = setup_root,
+}