If a playlist entry ends with a slash these scripts only show the basename which is empty. Fix this by stripping trailing slashes so that the last directory component becomes the basename.
Showing the changes to player/lua/select.lua (1 of 2 files). Show all
Unified · Split
| @@ -29,13 +29,16 @@ mp.add_forced_key_binding(nil, "select-playlist", function () · 28 unmodified lines | ||
| 29 | 29 | local playlist = {} |
| 30 | 30 | local default_item |
| 31 | 31 | local show = mp.get_property_native("osd-playlist-entry") |
| 32 | + local trailing_slash_pattern = mp.get_property("platform") == "windows" | |
| 33 | + and "[/\\]+$" or "/+$" | |
| 32 | 34 | |
| 33 | 35 | for i, entry in ipairs(mp.get_property_native("playlist")) do |
| 34 | 36 | playlist[i] = entry.title |
| 35 | 37 | if not playlist[i] or show ~= "title" then |
| 36 | 38 | playlist[i] = entry.filename |
| 37 | 39 | if not playlist[i]:find("://") then |
| 38 | − playlist[i] = select(2, utils.split_path(playlist[i])) | |
| 40 | + playlist[i] = select(2, utils.split_path( | |
| 41 | + playlist[i]:gsub(trailing_slash_pattern, ""))) | |
| 39 | 42 | end |
| 40 | 43 | end |
| 41 | 44 | if entry.title and show == "both" then |