Added playlist safety for videos that fail to play
This commit is contained in:
parent
575cf2705a
commit
03d492c946
16
ytbrowser.pl
16
ytbrowser.pl
@ -199,28 +199,32 @@ $suggestions->set_binding( sub {
|
||||
}, KEY_ENTER);
|
||||
$suggestions->set_binding( sub {
|
||||
my $video = $watchlist[0];
|
||||
unless($video) { return 0; }
|
||||
$cui->status("Playing Video, controls will resume once video is compelte\n Currently Playing: ".$watchArray[0]);
|
||||
my $success=`mpv --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($success) {
|
||||
shift(@watchlist);}
|
||||
if (0 == system("mpv --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}")) {
|
||||
shift(@watchArray);
|
||||
shift(@watchlist);
|
||||
sync2files();
|
||||
$win->draw();
|
||||
$suggestions->draw();
|
||||
$wlist->draw();
|
||||
$cui->status("Playback Complete, video cleared");
|
||||
} else {
|
||||
$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; }
|
||||
$cui->status("Playing Video, controls will resume once video is compelte\n Currently Playing: ".$watchArray[$wlist->get_active_id()]);
|
||||
my $success=`mpv --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 ($success) {
|
||||
if (0 == system("mpv --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}")) {
|
||||
splice(@watchArray,$wlist->get_active_id(),1);
|
||||
splice(@watchlist,$wlist->get_active_id(),1);
|
||||
sync2files();
|
||||
$win->draw();
|
||||
$suggestions->draw();
|
||||
$wlist->draw();
|
||||
$cui->status("Playback Complete, video cleared");
|
||||
} else {
|
||||
$cui->status("PLAYBACK ERROR: Video not removed for safety.");
|
||||
}
|
||||
@ -244,7 +248,7 @@ $suggestions->set_binding( sub {
|
||||
$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 = $videos[$wlist->get_active_id()];
|
||||
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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user