From b137e4bfc5b6aa6a00a6392c2c8298829bbf3172 Mon Sep 17 00:00:00 2001 From: CogentRedTester Date: Sat, 22 Feb 2025 15:43:56 +1030 Subject: [PATCH] fix and deprecate fb.get_dvd_device --- docs/addons.md | 5 +++-- modules/apis/fb.lua | 9 ++++++++- modules/globals.lua | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/addons.md b/docs/addons.md index a86fedc..caa7331 100644 --- a/docs/addons.md +++ b/docs/addons.md @@ -1,4 +1,4 @@ -# How to Write an Addon - API v1.7.0 +# How to Write an Addon - API v1.7.1 Addons provide ways for file-browser to parse non-native directory structures. This document describes how one can create their own custom addon. @@ -859,8 +859,9 @@ Used for custom-keybind filtering. The current directory open in the browser. -#### `fb.get_dvd_device(): string` +#### ~~`fb.get_dvd_device(): string`~~ +*DEPRECATED*. The current dvd-device as reported by mpv's `dvd-device` property. Formatted to work with file-browser. diff --git a/modules/apis/fb.lua b/modules/apis/fb.lua index f7739e5..1aba439 100644 --- a/modules/apis/fb.lua +++ b/modules/apis/fb.lua @@ -1,3 +1,4 @@ +local mp = require 'mp' local msg = require 'mp.msg' local utils = require 'mp.utils' @@ -106,7 +107,6 @@ function fb.get_sub_extensions() return fb.copy_table(g.sub_extensions) end function fb.get_audio_extensions() return fb.copy_table(g.audio_extensions) end function fb.get_parseable_extensions() return fb.copy_table(g.parseable_extensions) end function fb.get_state() return fb.copy_table(g.state) end -function fb.get_dvd_device() return g.dvd_device end function fb.get_parsers() return fb.copy_table(g.parsers) end function fb.get_root() return fb.copy_table(g.root) end function fb.get_directory() return g.state.directory end @@ -119,6 +119,13 @@ function fb.get_selected_item() return fb.copy_table(g.state.list[g.state.select function fb.get_open_status() return not g.state.hidden end function fb.get_parse_state(co) return g.parse_states[co or coroutine.running() or ""] end +-- deprecated +function fb.get_dvd_device() + local dvd_device = mp.get_property('dvd-device') + if not dvd_device then return nil end + return fb_utils.fix_path(dvd_device, true) +end + function fb.set_empty_text(str) g.state.empty_text = str fb.redraw() diff --git a/modules/globals.lua b/modules/globals.lua index 75db142..74967c3 100644 --- a/modules/globals.lua +++ b/modules/globals.lua @@ -9,7 +9,7 @@ local globals = {} local o = require 'modules.options' --sets the version for the file-browser API -globals.API_VERSION = "1.7.0" +globals.API_VERSION = "1.7.1" --gets the current platform (only works in mpv v0.36+) globals.PLATFORM = mp.get_property_native('platform')