aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortrizen <trizen@protonmail.com>2020-10-05 12:45:26 +0300
committerJesús <heckyel@hyperbola.info>2020-11-09 16:01:42 -0500
commitbbe5dab9e37a2cd6f25edb09e2949ce7270b3784 (patch)
tree2af3a1a39ef68efb9451b75227b54d5a50f47992 /bin
parentad60d6661706d750c45fba098813aa9f02307d55 (diff)
downloadfair-viewer-bbe5dab9e37a2cd6f25edb09e2949ce7270b3784.tar.lz
fair-viewer-bbe5dab9e37a2cd6f25edb09e2949ce7270b3784.tar.xz
fair-viewer-bbe5dab9e37a2cd6f25edb09e2949ce7270b3784.zip
- Added the "ignore_av1" config-option. (disabled by default)
When enabled, videos in AV1 format will be ignored. It's recommended to be enabled on slow hardware. Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fair-viewer32
-rwxr-xr-xbin/gtk-fair-viewer28
2 files changed, 28 insertions, 32 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer
index d0fcf8f..c72db85 100755
--- a/bin/fair-viewer
+++ b/bin/fair-viewer
@@ -227,6 +227,7 @@ my %CONFIG = (
skip_if_exists => 1,
prefer_mp4 => 0,
prefer_av1 => 0,
+ ignore_av1 => 0,
fat32safe => $constant{win32},
fullscreen => 0,
results_with_details => 0,
@@ -788,6 +789,7 @@ usage: $execname [options] ([url] | [keywords])
--confirm! : show a confirmation message after each play
--prefer-mp4! : prefer videos in MP4 format, instead of WEBM
--prefer-av1! : prefer videos in AV1 format, instead of WEBM
+ --ignore-av1! : ignore videos in AV1 format
* Closed-captions
--get-captions! : download closed-captions for videos
@@ -1112,6 +1114,7 @@ sub apply_configuration {
http_proxy page comments_order
subscriptions_order user_agent
cookie_file timeout ytdl ytdl_cmd
+ prefer_mp4 prefer_av1
)
) {
@@ -1140,14 +1143,6 @@ sub apply_configuration {
}
}
- if (defined $opt->{prefer_mp4}) {
- $yv_obj->set_prefer_mp4(delete($opt->{prefer_mp4}) ? 1 : 0);
- }
-
- if (defined $opt->{prefer_av1}) {
- $yv_obj->set_prefer_av1(delete($opt->{prefer_av1}) ? 1 : 0);
- }
-
if (defined $opt->{hd}) {
$yv_obj->set_videoDefinition(delete($opt->{hd}) ? 'high' : 'any');
}
@@ -1592,6 +1587,7 @@ sub parse_arguments {
'prefer-mp4!' => \$opt{prefer_mp4},
'prefer-av1!' => \$opt{prefer_av1},
+ 'ignore-av1!' => \$opt{ignore_av1},
'custom-layout!' => \$opt{custom_layout},
'custom-layout-format=s' => \$opt{custom_layout_format},
@@ -3074,15 +3070,17 @@ sub get_streaming_url {
$dash = $opt{merge_into_mkv} ? 1 : 0;
}
- my ($streaming, $resolution) =
- $yv_itags->find_streaming_url(
- urls => $urls,
- resolution => ($opt{novideo} ? 'audio' : $opt{resolution}),
- hfr => $opt{hfr},
- dash => $dash,
- dash_mp4_audio => ($opt{novideo} ? 1 : $opt{dash_mp4_audio}),
- dash_segmented => ($opt{download_video} ? 0 : $opt{dash_segmented}),
- );
+ my ($streaming, $resolution) = $yv_itags->find_streaming_url(
+ urls => $urls,
+ resolution => ($opt{novideo} ? 'audio' : $opt{resolution}),
+
+ hfr => $opt{hfr},
+ ignore_av1 => $opt{ignore_av1},
+
+ dash => $dash,
+ dash_mp4_audio => ($opt{novideo} ? 1 : $opt{dash_mp4_audio}),
+ dash_segmented => ($opt{download_video} ? 0 : $opt{dash_segmented}),
+ );
return {
streaming => $streaming,
diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer
index 18c52db..3274ce2 100755
--- a/bin/gtk-fair-viewer
+++ b/bin/gtk-fair-viewer
@@ -189,6 +189,7 @@ my %CONFIG = (
dash_segmented => 1, # may load slow
prefer_mp4 => 0,
prefer_av1 => 0,
+ ignore_av1 => 0,
maxResults => 10,
hfr => 1, # true to prefer high frame rate (HFR) videos
resolution => 'best',
@@ -881,6 +882,7 @@ sub apply_configuration {
region videoCategoryId
debug http_proxy user_agent
timeout cookie_file ytdl ytdl_cmd
+ prefer_mp4 prefer_av1
)
) {
@@ -901,12 +903,6 @@ sub apply_configuration {
# Enable/disable thumbnails
$thumbs_checkbutton->set_active($CONFIG{show_thumbs});
- # Prefer MP4 over WEBM
- $yv_obj->set_prefer_mp4($CONFIG{prefer_mp4} ? 1 : 0);
-
- # Prefer AV1 over WEBM
- $yv_obj->set_prefer_av1($CONFIG{prefer_av1} ? 1 : 0);
-
# Set the "More options" expander
$more_options_expander->set_expanded($CONFIG{active_more_options_expander});
@@ -3022,15 +3018,17 @@ sub get_streaming_url {
require WWW::FairViewer::Itags;
state $yv_itags = WWW::FairViewer::Itags->new();
- my ($streaming, $resolution) =
- $yv_itags->find_streaming_url(
- urls => $urls,
- resolution => $CONFIG{resolution},
- hfr => $CONFIG{hfr},
- dash => $CONFIG{dash_support},
- dash_mp4_audio => $CONFIG{dash_mp4_audio},
- dash_segmented => $CONFIG{dash_segmented},
- );
+ my ($streaming, $resolution) = $yv_itags->find_streaming_url(
+ urls => $urls,
+ resolution => $CONFIG{resolution},
+
+ hfr => $CONFIG{hfr},
+ ignore_av1 => $CONFIG{ignore_av1},
+
+ dash => $CONFIG{dash_support},
+ dash_mp4_audio => $CONFIG{dash_mp4_audio},
+ dash_segmented => $CONFIG{dash_segmented},
+ );
return {
streaming => $streaming,