History

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.

Guido Cella committed 2 years ago

Commit 7bcd5251 parent 2fd88ff3 files · +27 −9Browse files

Showing the changes to player/lua/select.lua (1 of 3 files). Show all

Unified · Split

player/lua/select.lua+21−3
@@ -62,6 +62,25 @@ mp.add_forced_key_binding(nil, "select-playlist", function () · 61 unmodified lines
6262 })
6363 end)
6464
65+local function format_flags(track)
66+ local flags = ""
67+
68+ for _, flag in ipairs({
69+ "default", "forced", "dependent", "visual-impaired", "hearing-impaired",
70+ "image", "external"
71+ }) do
72+ if track[flag] then
73+ flags = flags .. flag .. " "
74+ end
75+ end
76+
77+ if flags == "" then
78+ return ""
79+ end
80+
81+ return " [" .. flags:sub(1, -2) .. "]"
82+end
83+
6584 local function format_track(track)
6685 return (track.selected and "●" or "○") ..
6786 (track.title and " " .. track.title or "") ..
@@ -78,9 +97,8 @@ local function format_track(track) · 10 unmodified lines
7897 (track["codec-profile"] and track.type == "audio"
7998 and track["codec-profile"] .. " " or "") ..
8099 (track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
81− " kHz " or "") ..
82− (track.external and "external " or "")
83− ):sub(1, -2) .. ")"
100+ " kHz " or "")
101+ ):sub(1, -2) .. ")" .. format_flags(track)
84102 end
85103
86104 mp.add_forced_key_binding(nil, "select-track", function ()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t