various: sync shown track flags

Show the same flags in loadfile.c, select.lua and stats.lua. The only
differences are that only stats.lua prints both image and albumart
because it's supposed to show detailed track information, and select.lua
prints the image flag because pressing g-v doesn't show Video or Image
like in loadfile.c and stats.lua.
This commit is contained in:
Guido Cella authored and Kacper Michajłow committed 2024-07-18 22:52:35 +02:00
1 parent 2fd88ffbae
commit 7bcd525dce
3 files changed
+27 -9

No files matched your search

+21 -3
View File
@@ -62,6 +62,25 @@ mp.add_forced_key_binding(nil, "select-playlist", function ()
})
end)
local function format_flags(track)
local flags = ""
for _, flag in ipairs({
"default", "forced", "dependent", "visual-impaired", "hearing-impaired",
"image", "external"
}) do
if track[flag] then
flags = flags .. flag .. " "
end
end
if flags == "" then
return ""
end
return " [" .. flags:sub(1, -2) .. "]"
end
local function format_track(track)
return (track.selected and "●" or "○") ..
(track.title and " " .. track.title or "") ..
@@ -78,9 +97,8 @@ local function format_track(track)
(track["codec-profile"] and track.type == "audio"
and track["codec-profile"] .. " " or "") ..
(track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
" kHz " or "") ..
(track.external and "external " or "")
):sub(1, -2) .. ")"
" kHz " or "")
):sub(1, -2) .. ")" .. format_flags(track)
end
mp.add_forced_key_binding(nil, "select-track", function ()