Skip to content

Commit

Permalink
脚本: uosc 增加 “次字幕轨列表”
Browse files Browse the repository at this point in the history
  • Loading branch information
cest-la-v authored May 5, 2024
1 parent 0b0e0a6 commit 3bc3728
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions portable_config/input_uosc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 #! ※ 截屏
Expand Down
1 change: 1 addition & 0 deletions portable_config/scripts/uosc/lib/lang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '播放列表',
Expand Down
5 changes: 3 additions & 2 deletions portable_config/scripts/uosc/lib/menus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions portable_config/scripts/uosc/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'
))
Expand Down

0 comments on commit 3bc3728

Please sign in to comment.