Added sort functionality, added volume for playback
This commit is contained in:
parent
8bf9c27b5e
commit
188df677b0
19
ytbrowser.pl
19
ytbrowser.pl
@ -33,6 +33,7 @@ my $jsonDirty;
|
|||||||
my $rawFile;
|
my $rawFile;
|
||||||
my @videos = ();
|
my @videos = ();
|
||||||
my $recursionWatchdog = 0;
|
my $recursionWatchdog = 0;
|
||||||
|
my $volume = 50;
|
||||||
|
|
||||||
my $cookieCrisp = "";
|
my $cookieCrisp = "";
|
||||||
open (COOKIE, $cookiesFile) or die "I CANNOT FUNCTION WITHOUT COOKIES!!!\n";
|
open (COOKIE, $cookiesFile) or die "I CANNOT FUNCTION WITHOUT COOKIES!!!\n";
|
||||||
@ -202,7 +203,7 @@ $suggestions->set_binding( sub {
|
|||||||
my $video = $watchlist[0];
|
my $video = $watchlist[0];
|
||||||
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: ".$watchArray[0]);
|
||||||
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}")) {
|
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}")) {
|
||||||
shift(@watchArray);
|
shift(@watchArray);
|
||||||
shift(@watchlist);
|
shift(@watchlist);
|
||||||
sync2files();
|
sync2files();
|
||||||
@ -219,7 +220,7 @@ $wlist->set_binding( sub {
|
|||||||
my $video = $watchlist[$wlist->get_active_id()];
|
my $video = $watchlist[$wlist->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[$wlist->get_active_id()]);
|
$cui->status("Playing Video, controls will resume once video is compelte\n Currently Playing: ".$watchArray[$wlist->get_active_id()]);
|
||||||
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}")) {
|
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}")) {
|
||||||
splice(@watchArray,$wlist->get_active_id(),1);
|
splice(@watchArray,$wlist->get_active_id(),1);
|
||||||
splice(@watchlist,$wlist->get_active_id(),1);
|
splice(@watchlist,$wlist->get_active_id(),1);
|
||||||
sync2files();
|
sync2files();
|
||||||
@ -258,12 +259,18 @@ $wlist->set_binding( sub {
|
|||||||
} , "i");
|
} , "i");
|
||||||
|
|
||||||
$wlist->set_binding( sub {
|
$wlist->set_binding( sub {
|
||||||
# Sort shortest to longest
|
@watchlist = sort { $a->{runtime} cmp $b->{runtime} } @watchlist;
|
||||||
} , "<");
|
sync2files();
|
||||||
|
loadSugs();
|
||||||
|
$wlist->draw();
|
||||||
|
} , ">");
|
||||||
|
|
||||||
$wlist->set_binding( sub {
|
$wlist->set_binding( sub {
|
||||||
# Sort longest to shortest
|
@watchlist = sort { $b->{runtime} cmp $a->{runtime} } @watchlist;
|
||||||
}, ">");
|
sync2files();
|
||||||
|
loadSugs();
|
||||||
|
$wlist->draw();
|
||||||
|
}, "<");
|
||||||
|
|
||||||
$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\ni\tInfo about currently selected video\nr\tRefresh list from youtube\n?\tShow controls");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user