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().
Showing the changes to player/lua/osc.lua (1 of 8 files). Show all
Unified · Split
| @@ -56,7 +56,6 @@ local user_opts = { · 55 unmodified lines | ||
| 56 | 56 | livemarkers = true, -- update seekbar chapter markers on duration change |
| 57 | 57 | chapters_osd = true, -- whether to show chapters OSD on next/prev |
| 58 | 58 | 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 | |
| 60 | 59 | chapter_fmt = "Chapter: %s", -- chapter print format for seekbar-hover. "no" to disable |
| 61 | 60 | unicodeminus = false, -- whether to use the Unicode minus sign character |
| 62 | 61 | |
| @@ -525,14 +524,20 @@ local function get_playlist() · 462 unmodified lines | ||
| 525 | 524 | end |
| 526 | 525 | |
| 527 | 526 | local message = string.format('Playlist [%d/%d]:\n', pos, count) |
| 527 | + local show = mp.get_property_native('osd-playlist-entry') | |
| 528 | 528 | 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) | |
| 533 | 538 | end |
| 534 | 539 | message = string.format('%s %s %s\n', message, |
| 535 | − (v.current and '●' or '○'), title) | |
| 540 | + (v.current and '●' or '○'), entry) | |
| 536 | 541 | end |
| 537 | 542 | return message |
| 538 | 543 | end |