Added MPV_base to help with formatting commands
This commit is contained in:
parent
1300fbca2d
commit
c1accc0b9a
23
ytbrowser.pl
23
ytbrowser.pl
@ -52,6 +52,20 @@ if ($readFile) { @watchlist = @{decode_json($readFile)}; }
|
||||
SKIPWATCHLOAD:
|
||||
my %tests = map { $_->{id} => 1 } @watchlist;
|
||||
|
||||
sub MPV_base {
|
||||
my $string = "";
|
||||
$string .= "mpv --volume=".$volume;
|
||||
# MPV play nice please
|
||||
$string .= " --ytdl=no --scripts-pre=".$homeDir.".config/mpv/scripts/ytdl_hook.lua";
|
||||
|
||||
$string .= " --script-opts=ytdl_hook-ytdl_path=yt-dlp --ytdl-raw-options=";
|
||||
if ( grep( /^c$/, @_ )) { $string .= "cookies=$cookiesFile,"; }
|
||||
if ( grep( /^m$/, @_ )) { $string .= "mark-watched=,"; }
|
||||
$string .= "buffer-size=200M,format='bestvideo[height<=720]+bestaudio/best[height<=720]' --terminal=no ";
|
||||
$string .= "https://www.youtube.com/watch?v=";
|
||||
return $string;
|
||||
}
|
||||
|
||||
# Currently we read from a file that was rerived from
|
||||
# curl -b ~/.scripts/cookies.txt https://www.youtube.com
|
||||
# So we don't make Youtube mad at us. eventually we will
|
||||
@ -210,7 +224,8 @@ $suggestions->set_binding( sub {
|
||||
my $video = $videos[$suggestions->get_active_id()];
|
||||
unless($video) { return 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,buffer-size=200M,format='bestvideo[height<=720]+bestaudio/best[height<=720]' --terminal=no https://www.youtube.com/watch?v=$video->{id}")) {
|
||||
print DEBUG MPV_base("c").$video->{id}."\n";
|
||||
if (0 == system(MPV_base("c").$video->{id})) {
|
||||
$win->draw();
|
||||
$suggestions->draw();
|
||||
$wlist->draw();
|
||||
@ -224,7 +239,8 @@ $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}")) {
|
||||
print DEBUG MPV_base("c","m").$video->{id}."\n";
|
||||
if (0 == system(MPV_base("c","m").$video->{id})) {
|
||||
splice(@watchArray,$wlist->get_active_id(),1);
|
||||
splice(@watchlist,$wlist->get_active_id(),1);
|
||||
sync2files();
|
||||
@ -241,7 +257,8 @@ $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}")) {
|
||||
print DEBUG MPV_base("c").$video->{id}."\n";
|
||||
if (0 == system(MPV_base("c").$video->{id})) {
|
||||
$win->draw();
|
||||
$suggestions->draw();
|
||||
$wlist->draw();
|
||||
|
Loading…
x
Reference in New Issue
Block a user