select.lua: select editions

This commit is contained in:
Guido Cella
2024-11-28 19:03:08 +01:00
committed by Kacper Michajłow
parent 17e62fcc61
commit 43f4568816
3 changed files with 27 additions and 0 deletions

View File

@@ -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")