History

options: add --osd-playlist-entry

Allow configuring whether to print the media-title, the filename or both (as `<title> (<filename>)`) in show-text ${playlist}, the OSC playlist and in the playlist selector. Showing only titles hides information when files are badly tagged, or when it hides the track numbers of album songs. But showing filenames is not as useful as titles e.g. when playing URLs with media titles. This option lets the user choose which one to show, or show both if switching is inconvenient. The OSC's playlist_media_title script-opt is removed because this option is better since it works everywhere after configuring it once. Closes #11653. Also show the full URLs of playlist entries instead of their basenames in osc.lua and select.lua, consistently with mp_property_playlist(). For simplicity, this just checks if entries contain :// instead of replicating all of mp_is_url().

Guido Cella committed 2 years ago

Commit dc998561 parent d53aa6d8 files · +42 −17Browse files

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

Unified · Split

player/lua/select.lua+11−1
@@ -28,9 +28,19 @@ end · 27 unmodified lines
2828 mp.add_forced_key_binding(nil, "select-playlist", function ()
2929 local playlist = {}
3030 local default_item
31+ local show = mp.get_property_native("osd-playlist-entry")
3132
3233 for i, entry in ipairs(mp.get_property_native("playlist")) do
33− playlist[i] = select(2, utils.split_path(entry.filename))
34+ playlist[i] = entry.title
35+ if not playlist[i] or show ~= "title" then
36+ playlist[i] = entry.filename
37+ if not playlist[i]:find("://") then
38+ playlist[i] = select(2, utils.split_path(playlist[i]))
39+ end
40+ end
41+ if entry.title and show == "both" then
42+ playlist[i] = string.format("%s (%s)", entry.title, playlist[i])
43+ end
3444
3545 if entry.playing then
3646 default_item = i

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