select.lua: don't use add_forced_key_binding

There's no advantage in using the forced version here. It is a leftover
from when this was an external script and forced was necessary to bind
key sequences reliably until 3f83671f20.
This commit is contained in:
Guido Cella 2024-09-17 11:34:56 +02:00 committed by Dudemanguy
parent 140196f297
commit e3eeaec813
1 changed files with 11 additions and 11 deletions

View File

@ -25,7 +25,7 @@ local function show_error(message)
end end
end end
mp.add_forced_key_binding(nil, "select-playlist", function () mp.add_key_binding(nil, "select-playlist", function ()
local playlist = {} local playlist = {}
local default_item local default_item
local show = mp.get_property_native("osd-playlist-entry") local show = mp.get_property_native("osd-playlist-entry")
@ -108,7 +108,7 @@ local function format_track(track)
):sub(1, -2) .. ")" .. format_flags(track) ):sub(1, -2) .. ")" .. format_flags(track)
end end
mp.add_forced_key_binding(nil, "select-track", function () mp.add_key_binding(nil, "select-track", function ()
local tracks = {} local tracks = {}
for i, track in ipairs(mp.get_property_native("track-list")) do for i, track in ipairs(mp.get_property_native("track-list")) do
@ -166,21 +166,21 @@ local function select_track(property, type, prompt, error)
}) })
end end
mp.add_forced_key_binding(nil, "select-sid", function () mp.add_key_binding(nil, "select-sid", function ()
select_track("sid", "sub", "Select a subtitle:", "No available subtitles.") select_track("sid", "sub", "Select a subtitle:", "No available subtitles.")
end) end)
mp.add_forced_key_binding(nil, "select-secondary-sid", function () mp.add_key_binding(nil, "select-secondary-sid", function ()
select_track("secondary-sid", "sub", "Select a secondary subtitle:", select_track("secondary-sid", "sub", "Select a secondary subtitle:",
"No available subtitles.") "No available subtitles.")
end) end)
mp.add_forced_key_binding(nil, "select-aid", function () mp.add_key_binding(nil, "select-aid", function ()
select_track("aid", "audio", "Select an audio track:", select_track("aid", "audio", "Select an audio track:",
"No available audio tracks.") "No available audio tracks.")
end) end)
mp.add_forced_key_binding(nil, "select-vid", function () mp.add_key_binding(nil, "select-vid", function ()
select_track("vid", "video", "Select a video track:", select_track("vid", "video", "Select a video track:",
"No available video tracks.") "No available video tracks.")
end) end)
@ -198,7 +198,7 @@ local function format_time(t, duration)
return string.format("%.2d:%.2d", m, s) return string.format("%.2d:%.2d", m, s)
end end
mp.add_forced_key_binding(nil, "select-chapter", function () mp.add_key_binding(nil, "select-chapter", function ()
local chapters = {} local chapters = {}
local default_item = mp.get_property_native("chapter") local default_item = mp.get_property_native("chapter")
@ -223,7 +223,7 @@ mp.add_forced_key_binding(nil, "select-chapter", function ()
}) })
end) end)
mp.add_forced_key_binding(nil, "select-subtitle-line", function () mp.add_key_binding(nil, "select-subtitle-line", function ()
local sub = mp.get_property_native("current-tracks/sub") local sub = mp.get_property_native("current-tracks/sub")
if sub == nil then if sub == nil then
@ -290,7 +290,7 @@ mp.add_forced_key_binding(nil, "select-subtitle-line", function ()
}) })
end) end)
mp.add_forced_key_binding(nil, "select-audio-device", function () mp.add_key_binding(nil, "select-audio-device", function ()
local devices = mp.get_property_native("audio-device-list") local devices = mp.get_property_native("audio-device-list")
local items = {} local items = {}
-- This is only useful if an --audio-device has been explicitly set, -- This is only useful if an --audio-device has been explicitly set,
@ -322,7 +322,7 @@ mp.add_forced_key_binding(nil, "select-audio-device", function ()
}) })
end) end)
mp.add_forced_key_binding(nil, "select-binding", function () mp.add_key_binding(nil, "select-binding", function ()
local bindings = {} local bindings = {}
for _, binding in pairs(mp.get_property_native("input-bindings")) do for _, binding in pairs(mp.get_property_native("input-bindings")) do
@ -368,7 +368,7 @@ local function add_property(property, value)
end end
end end
mp.add_forced_key_binding(nil, "show-properties", function () mp.add_key_binding(nil, "show-properties", function ()
properties = {} properties = {}
-- Don't log errors for renamed and removed properties. -- Don't log errors for renamed and removed properties.