From 8bf9c27b5ea93c07612d8f1b57cd226ab02f616c Mon Sep 17 00:00:00 2001 From: bluesaxman Date: Tue, 25 Oct 2022 16:21:43 -0600 Subject: [PATCH] Added place holders for sorting playlist, added control documentation. --- ytbrowser.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ytbrowser.pl b/ytbrowser.pl index 72fed93..4a36b4d 100755 --- a/ytbrowser.pl +++ b/ytbrowser.pl @@ -197,6 +197,7 @@ $suggestions->set_binding( sub { $suggestions->draw(); $wlist->draw(); }, KEY_ENTER); + $suggestions->set_binding( sub { my $video = $watchlist[0]; unless($video) { return 0; } @@ -213,6 +214,7 @@ $suggestions->set_binding( sub { $cui->status("PLAYBACK ERROR: Video not removed for safety."); } }, "p"); + $wlist->set_binding( sub { my $video = $watchlist[$wlist->get_active_id()]; unless($video) { return 0; } @@ -229,6 +231,7 @@ $wlist->set_binding( sub { $cui->status("PLAYBACK ERROR: Video not removed for safety."); } } , "p"); + $suggestions->set_binding( sub { splice(@videos,0,scalar(@videos)); splice(@suggestArray,0,scalar(@suggestArray)); @@ -243,16 +246,32 @@ $suggestions->set_binding( sub { $suggestions->draw(); $wlist->draw(); }, "r"); + $suggestions->set_binding( sub { my $vid = $videos[$suggestions->get_active_id()]; $cui->status("Video: ".$vid->{title}."\nChannel: ".$vid->{channel}."\nRuntime: ".$vid->{runtime}."\nPublished: ".$vid->{published}."\nURL: https://www.youtube.com/watch?v=".$vid->{id}); }, "i"); + $wlist->set_binding( sub { my $vid = $watchlist[$wlist->get_active_id()]; $cui->status("Video: ".$vid->{title}."\nChannel: ".$vid->{channel}."\nRuntime: ".$vid->{runtime}."\nPublished: ".$vid->{published}."\nURL: https://www.youtube.com/watch?v=".$vid->{id}); - } , "i"); +$wlist->set_binding( sub { + # Sort shortest to longest +} , "<"); + +$wlist->set_binding( sub { + # Sort longest to shortest +}, ">"); + +$suggestions->set_binding( sub { + $cui->status("Controls:\nEnter\tAdd a video to the playlist\np\tPlay currently selected video\ni\tInfo about currently selected video\nr\tRefresh list from youtube\n?\tShow controls"); +}, "?"); +$wlist->set_binding( sub { + $cui->status("Controls:\n<\tSort from shortest to longest\n>\tSort from longest to shortest\np\tPlay currently selected video\ni\tInfo about currently selected video\n?\tShow controls"); +}, "?"); + $suggestions->focus(); $cui->mainloop();