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/osc.lua (1 of 8 files). Show all

Unified · Split

player/lua/osc.lua+11−6
@@ -56,7 +56,6 @@ local user_opts = { · 55 unmodified lines
5656 livemarkers = true, -- update seekbar chapter markers on duration change
5757 chapters_osd = true, -- whether to show chapters OSD on next/prev
5858 playlist_osd = true, -- whether to show playlist OSD on next/prev
59− playlist_media_title = true, -- whether to use media titles as playlist entry names
6059 chapter_fmt = "Chapter: %s", -- chapter print format for seekbar-hover. "no" to disable
6160 unicodeminus = false, -- whether to use the Unicode minus sign character
6261
@@ -525,14 +524,20 @@ local function get_playlist() · 462 unmodified lines
525524 end
526525
527526 local message = string.format('Playlist [%d/%d]:\n', pos, count)
527+ local show = mp.get_property_native('osd-playlist-entry')
528528 for _, v in ipairs(limlist) do
529− local title = v.title
530− local _, filename = utils.split_path(v.filename)
531− if not user_opts.playlist_media_title or title == nil then
532− title = filename
529+ local entry = v.title
530+ if not entry or show ~= 'title' then
531+ entry = v.filename
532+ if not entry:find("://") then
533+ entry = select(2, utils.split_path(entry))
534+ end
535+ end
536+ if v.title and show == 'both' then
537+ entry = string.format('%s (%s)', v.title, entry)
533538 end
534539 message = string.format('%s %s %s\n', message,
535− (v.current and '●' or '○'), title)
540+ (v.current and '●' or '○'), entry)
536541 end
537542 return message
538543 end

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