From 3bc372885bee5e402f8b27280a477b419f23c5b4 Mon Sep 17 00:00:00 2001 From: Vinci <22951622+viva-la-v@users.noreply.github.com> Date: Sun, 5 May 2024 23:11:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=9A=20uosc=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20=E2=80=9C=E6=AC=A1=E5=AD=97=E5=B9=95=E8=BD=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portable_config/input_uosc.conf | 1 + portable_config/scripts/uosc/lib/lang.lua | 1 + portable_config/scripts/uosc/lib/menus.lua | 5 +++-- portable_config/scripts/uosc/main.lua | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/portable_config/input_uosc.conf b/portable_config/input_uosc.conf index 218063da..ad004e70 100644 --- a/portable_config/input_uosc.conf +++ b/portable_config/input_uosc.conf @@ -11,6 +11,7 @@ # script-binding uosc/video #! 导航 > ※ 视频轨列表 # script-binding uosc/audio #! 导航 > ※ 音频轨列表 # script-binding uosc/subtitles #! 导航 > ※ 字幕轨列表 +# script-binding uosc/subtitles-sec #! 导航 > ※ 次字幕轨列表 # playlist-shuffle #! 导航 > 播放列表乱序重排 # script-binding uosc/shot #! ※ 截屏 diff --git a/portable_config/scripts/uosc/lib/lang.lua b/portable_config/scripts/uosc/lib/lang.lua index a9c58bf6..a240f513 100644 --- a/portable_config/scripts/uosc/lib/lang.lua +++ b/portable_config/scripts/uosc/lib/lang.lua @@ -98,6 +98,7 @@ ulang = { _input_empty = 'input-bindings 为空', _sid_submenu_title = '字幕轨列表', + _sid_sec_submenu_title = '次字幕轨列表', _aid_submenu_title = '音频轨列表', _vid_submenu_title = '视频轨列表', _playlist_submenu_title = '播放列表', diff --git a/portable_config/scripts/uosc/lib/menus.lua b/portable_config/scripts/uosc/lib/menus.lua index 0b4e53d5..755a682e 100644 --- a/portable_config/scripts/uosc/lib/menus.lua +++ b/portable_config/scripts/uosc/lib/menus.lua @@ -126,6 +126,7 @@ function create_select_tracklist_type_menu_opener(menu_title, track_type, track_ for _, track in ipairs(tracklist) do if track.type == track_type then local hint_values = {} + local selected_by_prop = track.selected and utils.to_string(track.id) == mp.get_property(track_prop) local function h(value) hint_values[#hint_values + 1] = value end if track.lang then h(track.lang:upper()) end @@ -144,10 +145,10 @@ function create_select_tracklist_type_menu_opener(menu_title, track_type, track_ title = (track.title and track.title or ulang._submenu_id_title .. track.id), hint = table.concat(hint_values, ', '), value = track.id, - active = track.selected, + active = selected_by_prop, } - if track.selected then + if selected_by_prop then if disabled_item then disabled_item.active = false end active_index = #items end diff --git a/portable_config/scripts/uosc/main.lua b/portable_config/scripts/uosc/main.lua index 98bdb91d..da65851e 100644 --- a/portable_config/scripts/uosc/main.lua +++ b/portable_config/scripts/uosc/main.lua @@ -880,6 +880,9 @@ bind_command('load-video', create_track_loader_menu_opener({ bind_command('subtitles', create_select_tracklist_type_menu_opener( ulang._sid_submenu_title, 'sub', 'sid', 'script-binding uosc/load-subtitles', 'script-binding uosc/download-subtitles' )) +bind_command('subtitles-sec', create_select_tracklist_type_menu_opener( + ulang._sid_sec_submenu_title, 'sub', 'secondary-sid', 'script-binding uosc/load-subtitles', 'script-binding uosc/download-subtitles' +)) bind_command('audio', create_select_tracklist_type_menu_opener( ulang._aid_submenu_title, 'audio', 'aid', 'script-binding uosc/load-audio' ))