@@ -517,9 +517,17 @@ mp.add_key_binding(nil, "select-watch-later", function ()
517
517
for _ , watch_later_file in pairs (watch_later_files ) do
518
518
local file_handle = io.open (watch_later_file )
519
519
if file_handle then
520
- local line = file_handle :read ()
521
- if line and line ~= " # redirect entry" and line :find (" ^#" ) then
522
- files [# files + 1 ] = {line :sub (3 ), utils .file_info (watch_later_file ).mtime }
520
+ local line1 = file_handle :read ()
521
+ local line2 = file_handle :read ()
522
+ if line1 and line1 ~= " # redirect entry" and line1 :find (" ^#" ) then
523
+ local entry = {
524
+ path = line1 :sub (3 ),
525
+ time = utils .file_info (watch_later_file ).mtime
526
+ }
527
+ if line2 and line2 :find (" ^#" ) then
528
+ entry .title = line2 :sub (3 )
529
+ end
530
+ files [# files + 1 ] = entry
523
531
end
524
532
file_handle :close ()
525
533
end
@@ -533,19 +541,19 @@ mp.add_key_binding(nil, "select-watch-later", function ()
533
541
end
534
542
535
543
table.sort (files , function (i , j )
536
- return i [ 2 ] > j [ 2 ]
544
+ return i . time > j . time
537
545
end )
538
546
539
547
local items = {}
540
- for i , file in ipairs (files ) do
541
- items [i ] = os.date ( " (%Y-%m-%d) " , file [ 2 ]) .. file [ 1 ]
548
+ for i , entry in ipairs (files ) do
549
+ items [i ] = format_history_entry ( entry )
542
550
end
543
551
544
552
input .select ({
545
553
prompt = " Select a file:" ,
546
554
items = items ,
547
555
submit = function (i )
548
- mp .commandv (" loadfile" , files [i ][ 1 ] )
556
+ mp .commandv (" loadfile" , files [i ]. path )
549
557
end ,
550
558
})
551
559
end )
0 commit comments