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
62 })62 })
63end)63end)
64 64
65local 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) .. "]"
82end
83
65local function format_track(track)84local function format_track(track)
66 return (track.selected and "●" or "○") ..85 return (track.selected and "●" or "○") ..
67 (track.title and " " .. track.title or "") ..86 (track.title and " " .. track.title or "") ..
@@ -78,9 +97,8 @@ local function format_track(track) · 10 unmodified lines
78 (track["codec-profile"] and track.type == "audio"97 (track["codec-profile"] and track.type == "audio"
79 and track["codec-profile"] .. " " or "") ..98 and track["codec-profile"] .. " " or "") ..
80 (track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..99 (track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
81 " kHz " or "") ..100 " kHz " or "")
82 (track.external and "external " or "")101 ):sub(1, -2) .. ")" .. format_flags(track)
83 ):sub(1, -2) .. ")"
84end102end
85 103
86mp.add_forced_key_binding(nil, "select-track", function ()104mp.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