aboutsummaryrefslogtreecommitdiffstats
path: root/bin/gtk-fair-viewer
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gtk-fair-viewer')
-rwxr-xr-xbin/gtk-fair-viewer36
1 files changed, 20 insertions, 16 deletions
diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer
index 8cd773a..dcc787b 100755
--- a/bin/gtk-fair-viewer
+++ b/bin/gtk-fair-viewer
@@ -24,13 +24,13 @@
# https://github.com/trizen/youtube-viewer
use utf8;
-use 5.014;
+use 5.016;
use warnings;
no warnings 'once';
my $DEVEL; # true in devel mode
-use if ($DEVEL = 1), lib => qw(../lib); # devel only
+use if ($DEVEL = 0), lib => qw(../lib); # devel only
use WWW::FairViewer v1.0.4;
use WWW::FairViewer::RegularExpressions;
@@ -209,9 +209,9 @@ my %CONFIG = (
# URI options
thumbnail_type => 'medium',
- youtube_video_url => 'https://invidio.us/watch?v=%s',
- youtube_playlist_url => 'https://invidio.us/playlist?list=%s',
- youtube_channel_url => 'https://invidio.us/channel/%s',
+ youtube_video_url => 'https://www.youtube.com/watch?v=%s',
+ youtube_playlist_url => 'https://www.youtube.com/playlist?list=%s',
+ youtube_channel_url => 'https://www.youtube.com/channel/%s',
# Subtitle options
srt_languages => ['en', 'es'],
@@ -476,7 +476,7 @@ foreach my $path($CONFIG{cache_dir}) {
{
my $split_string = sub {
- grep { $_ ne '' } split(/\W+/, lc($_[0]));
+ grep { $_ ne '' } split(/\W+/, CORE::fc($_[0]));
};
my %history_dict;
@@ -537,7 +537,7 @@ foreach my $path($CONFIG{cache_dir}) {
}
foreach my $token (@tokens) {
- @matches = grep { index(lc($_), $token) != -1 } @matches;
+ @matches = grep { index(CORE::fc($_), $token) != -1 } @matches;
}
my $store = Gtk3::ListStore->new(['Glib::String']);
@@ -643,7 +643,7 @@ foreach my $path($CONFIG{cache_dir}) {
else {
unshift @search_history, $line;
}
- undef $history{lc($line)};
+ undef $history{CORE::fc($line)};
}
require List::Util;
@@ -726,7 +726,7 @@ foreach my $path($CONFIG{cache_dir}) {
my $str = join(' ', split(' ', $text));
- if ($is_search_keyword or not exists $history{lc($str)}) {
+ if ($is_search_keyword or not exists $history{CORE::fc($str)}) {
if (set_history()) {
if ($is_search_keyword) {
@@ -736,7 +736,7 @@ foreach my $path($CONFIG{cache_dir}) {
say {$history_fh} "~" . $str;
}
}
- undef $history{$str};
+ undef $history{CORE::fc($str)};
update_history_dict($str);
}
}
@@ -1382,7 +1382,7 @@ set_text(
CTRL+H : help window
CTRL+L : login window
CTRL+P : preferences window
- CTRL+Y : start CLI fair viewer
+ CTRL+Y : start CLI Fair Viewer
CTRL+E : enqueue the selected video
CTRL+U : show the saved user-list
@@ -2538,10 +2538,14 @@ sub display_results {
}
if (ref($items) ne 'ARRAY') {
+
+ my $current_instance = $yv_obj->get_api_host();
+ $yv_obj->pick_and_set_random_instance(); # set a random invidious instance
+
die
- "Probably " . $yv_obj->get_api_host() . " is down.\n"
+ "Probably $current_instance is down.\n"
. "\nTry changing the `api_host` in configuration file:\n\n"
- . qq{\tapi_host => "invidious.13ad.de",\n}
+ . qq{\tapi_host => "auto",\n}
. qq{\nSee also: https://libregit.org/heckyel/fair-viewer#invidious-instances\n};
}
@@ -2654,9 +2658,9 @@ sub display_results {
#$item->{__is_video__} = 1;
# Store the video title to history (when `save_titles_to_history` is true)
- #if ($CONFIG{save_titles_to_history}) {
- # append_to_history($yv_utils->get_title($item), 0);
- #}
+ if ($CONFIG{save_titles_to_history}) {
+ append_to_history($yv_utils->get_title($item), 0);
+ }
add_video_entry($item);
}