Skip to content

Commit 7d78a66

Browse files
Guido Cellayatinlala
authored andcommitted
select.lua: show playlists with a title in watch later menu
Add redirect entries with a title to the watch later menu, e.g. youtube playlists. Checking for the title avoids showing redirect entries of local directories, which would drastically increase the number of entries, when you can already play adjacent local files with --autocreate-playlist.
1 parent dc5c6ad commit 7d78a66

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

player/lua/select.lua

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,19 +518,31 @@ mp.add_key_binding(nil, "select-watch-later", function ()
518518
local file_handle = io.open(watch_later_file)
519519
if file_handle then
520520
local line1 = file_handle:read()
521-
if line1 and line1 ~= "# redirect entry" and line1:find("^#") then
522-
local entry = {
523-
path = line1:sub(3),
524-
time = utils.file_info(watch_later_file).mtime
525-
}
521+
local is_redirect = false
522+
523+
if line1 == "# redirect entry" then
524+
is_redirect = true
525+
line1 = file_handle:read()
526+
end
527+
528+
if line1 and line1:find("^#") then
529+
local entry = {}
530+
526531
for line in file_handle:lines() do
527532
if line:find("^# title: ") then
528533
entry.title = line:sub(10)
529534
break
530535
end
531536
end
532-
files[#files + 1] = entry
537+
538+
if not is_redirect or entry.title then
539+
entry.path = line1:sub(3)
540+
entry.time = utils.file_info(watch_later_file).mtime
541+
542+
files[#files + 1] = entry
543+
end
533544
end
545+
534546
file_handle:close()
535547
end
536548
end

0 commit comments

Comments
 (0)