Skip to content

Commit

Permalink
fix incorrect track selection status (#63)
Browse files Browse the repository at this point in the history
* fix incorrect track selection status

* update subtitle status

---------

Co-authored-by: Shuanglei Tao <[email protected]>
  • Loading branch information
dyphire and tsl0922 authored Jun 27, 2024
1 parent 21825a1 commit 7ab8577
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lua/dyn_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,19 @@ local function build_track_items(list, type, prop, prefix)
-- filename without extension, escaped for pattern matching
local filename = get('filename/no-ext', ''):gsub("[%(%)%.%%%+%-%*%?%[%]%^%$]", "%%%0")
local pos = tonumber(get(prop)) or -1

for _, track in ipairs(list) do
if track.type == type then
local state = {}
-- there may be 2 tracks selected at the same time, for example: subtitle
if track.selected then
if track.selected and track.id == pos then
state[#state + 1] = 'checked'
if track.id ~= pos then state[#state + 1] = 'disabled' end
if type == 'sub' then
if (prop == 'sid' and not get('sub-visibility')) or
(prop == 'secondary-sid' and not get('secondary-sub-visibility'))
then
state[#state + 1] = 'disabled'
end
end
end

items[#items + 1] = {
Expand Down

0 comments on commit 7ab8577

Please sign in to comment.