Added manual adding binding but no functionality, changed p when on suggestions to play the selected suggestion, added w to watch video on playlist without removing it

This commit is contained in:
bluesaxman 2023-02-14 14:48:04 -07:00
parent 188df677b0
commit dd3d2c5ca7

View File

@ -200,19 +200,17 @@ $suggestions->set_binding( sub {
}, KEY_ENTER); }, KEY_ENTER);
$suggestions->set_binding( sub { $suggestions->set_binding( sub {
my $video = $watchlist[0]; my $info = (split($suggestArray[$suggestions->get_active_id()],2))[1];
my $video = $videos[$suggestions->get_active_id()];
unless($video) { return 0; } unless($video) { return 0; }
$cui->status("Playing Video, controls will resume once video is compelte\n Currently Playing: ".$watchArray[0]); $cui->status("Playing Video, controls will resume once video is compelte\n Currently Playing: ".$info);
if (0 == system("mpv --volume=".$volume." --script-opts=ytdl_hook-ytdl_path=yt-dlp --ytdl-raw-options=cookies=$cookiesFile,mark-watched=,buffer-size=200M,format='bestvideo[height<=720]+bestaudio/best[height<=720]' --terminal=no https://www.youtube.com/watch?v=$video->{id}")) { if (0 == system("mpv --volume=".$volume." --script-opts=ytdl_hook-ytdl_path=yt-dlp --ytdl-raw-options=cookies=$cookiesFile,buffer-size=200M,format='bestvideo[height<=720]+bestaudio/best[height<=720]' --terminal=no https://www.youtube.com/watch?v=$video->{id}")) {
shift(@watchArray);
shift(@watchlist);
sync2files();
$win->draw(); $win->draw();
$suggestions->draw(); $suggestions->draw();
$wlist->draw(); $wlist->draw();
$cui->status("Playback Complete, video cleared"); $cui->status("Playback Complete");
} else { } else {
$cui->status("PLAYBACK ERROR: Video not removed for safety."); $cui->status("PLAYBACK ERROR");
} }
}, "p"); }, "p");
@ -233,6 +231,20 @@ $wlist->set_binding( sub {
} }
} , "p"); } , "p");
$wlist->set_binding( sub {
my $video = $watchlist[$wlist->get_active_id()];
unless($video) { return 0; }
$cui->status("Playing Video, controls will resume once video is compelte\n Currently Playing: ".$watchArray[$wlist->get_active_id()]);
if (0 == system("mpv --volume=".$volume." --script-opts=ytdl_hook-ytdl_path=yt-dlp --ytdl-raw-options=cookies=$cookiesFile,mark-watched=,buffer-size=200M,format='bestvideo[height<=720]+bestaudio/best[height<=720]' --terminal=no https://www.youtube.com/watch?v=$video->{id}")) {
$win->draw();
$suggestions->draw();
$wlist->draw();
$cui->status("Playback Complete");
} else {
$cui->status("PLAYBACK ERROR.");
}
} , "w");
$suggestions->set_binding( sub { $suggestions->set_binding( sub {
splice(@videos,0,scalar(@videos)); splice(@videos,0,scalar(@videos));
splice(@suggestArray,0,scalar(@suggestArray)); splice(@suggestArray,0,scalar(@suggestArray));
@ -272,11 +284,15 @@ $wlist->set_binding( sub {
$wlist->draw(); $wlist->draw();
}, "<"); }, "<");
$wlist->set_binding( sub {
$cui->status("Manual Adding not implimented at this time");
}, "m");
$suggestions->set_binding( sub { $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"); $cui->status("Controls:\nEnter\tAdd a video to the playlist\np\tPlay currently selected video from suggestions\ni\tInfo about currently selected video\nr\tRefresh list from youtube\n?\tShow controls");
}, "?"); }, "?");
$wlist->set_binding( sub { $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"); $cui->status("Controls:\n<\tSort from shortest to longest\n>\tSort from longest to shortest\np\tPlay currently selected video from playlist, then remove it\nw\tPlay currently selected video from playlist without removing it\ni\tInfo about currently selected video\nm\tManually Add a video by URL\n?\tShow controls");
}, "?"); }, "?");
$suggestions->focus(); $suggestions->focus();