mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
select.lua: select editions
This commit is contained in:
committed by
Kacper Michajłow
parent
17e62fcc61
commit
43f4568816
@@ -223,6 +223,29 @@ mp.add_key_binding(nil, "select-chapter", function ()
|
||||
})
|
||||
end)
|
||||
|
||||
mp.add_key_binding(nil, "select-edition", function ()
|
||||
local editions = {}
|
||||
local default_item = mp.get_property_native("current-edition")
|
||||
|
||||
if default_item == nil then
|
||||
show_error("No available editions.")
|
||||
return
|
||||
end
|
||||
|
||||
for i, edition in ipairs(mp.get_property_native("edition-list")) do
|
||||
editions[i] = edition.title
|
||||
end
|
||||
|
||||
input.select({
|
||||
prompt = "Select an edition:",
|
||||
items = editions,
|
||||
default_item = default_item + 1,
|
||||
submit = function (edition)
|
||||
mp.set_property("edition", edition - 1)
|
||||
end,
|
||||
})
|
||||
end)
|
||||
|
||||
mp.add_key_binding(nil, "select-subtitle-line", function ()
|
||||
local sub = mp.get_property_native("current-tracks/sub")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user