aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fair-viewer26
-rwxr-xr-xbin/gtk-fair-viewer9
2 files changed, 19 insertions, 16 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer
index 7f3377c..d50164f 100755
--- a/bin/fair-viewer
+++ b/bin/fair-viewer
@@ -16,7 +16,7 @@
#-------------------------------------------------------
# fair-viewer
# Fork: 14 February 2020
-# Edit: 14 February 2020
+# Edit: 05 June 2020
# https://framagit.org/heckyel/fair-viewer
#-------------------------------------------------------
@@ -2078,15 +2078,21 @@ sub rate_videos {
sub get_and_play_video_ids {
(my @ids = grep { get_valid_video_id($_) } @_) || return;
- my $info = $yv_obj->video_details(join(',', @ids));
- if ($yv_utils->has_entries($info)) {
- if (not play_videos([$info->{results}])) {
- return;
+ foreach my $id (@ids) {
+ my $info = $yv_obj->video_details($id);
+
+ if (ref($info) eq 'HASH' and keys %$info) {
+ ## OK
}
- }
- else {
- warn_cant_do('get info for', @ids);
+ else {
+ $info->{title} = "unknwon";
+ $info->{lengthSeconds} = 0;
+ $info->{videoId} = $id;
+ warn_cant_do('get info for', $id);
+ }
+
+ play_videos([$info]) || return;
}
return 1;
@@ -2107,9 +2113,9 @@ sub get_and_print_video_info {
my $videoID = get_valid_video_id($id) // next;
my $info = $yv_obj->video_details($videoID);
- if ($yv_utils->has_entries($info)) {
+ if (ref($info) eq 'HASH' and keys %$info) {
local $opt{show_video_info} = 1;
- print_video_info($info->{results});
+ print_video_info($info);
}
else {
warn_cant_do('get info for', $videoID);
diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer
index e8ea8c4..e68a8c4 100755
--- a/bin/gtk-fair-viewer
+++ b/bin/gtk-fair-viewer
@@ -16,7 +16,7 @@
#-------------------------------------------------------
# GTK Fair Viewer
# Fork: 14 February 2020
-# Edit: 14 February 2020
+# Edit: 05 June 2020
# https://framagit.org/heckyel/fair-viewer
#-------------------------------------------------------
@@ -2226,11 +2226,8 @@ sub check_keywords {
if ($key =~ /$get_video_id_re/o) {
my $info = $yv_obj->video_details($+{video_id});
-
- if ($yv_utils->has_entries($info)) {
- if (not play_video($info->{results})) {
- return;
- }
+ if (ref($info) eq 'HASH' and keys %$info) {
+ play_video($info) || return;
}
else {
return;