Skip to content
Permalink
Browse files

- Removed the usage of the smartmatch operator and the `given/when` c…

…onstructs, as they will change in perl-5.28.

- Removed some dead code.
  • Loading branch information...
trizen committed Dec 23, 2017
1 parent b587f17 commit cfa326d9f83d340b7fe108d32d6f38a39a816088
Showing with 722 additions and 1,213 deletions.
  1. +1 −0 Build.PL
  2. +3 −2 META.json
  3. +1 −0 META.yml
  4. +1 −0 Makefile.PL
  5. +34 −30 bin/gtk-youtube-viewer
  6. +496 −945 bin/youtube-viewer
  7. +25 −68 lib/WWW/YoutubeViewer.pm
  8. +161 −161 lib/WWW/YoutubeViewer/ParseXML.pm
  9. +0 −7 lib/WWW/YoutubeViewer/RegularExpressions.pm
@@ -38,6 +38,7 @@ my $builder = Module::Build->new(
},

requires => {
'perl' => 5.016,
'Data::Dump' => 0,
'File::Spec' => 0,
'File::Spec::Functions' => 0,
@@ -48,7 +48,8 @@
"Term::ReadLine" : "0",
"Text::ParseWords" : "0",
"Text::Wrap" : "0",
"URI::Escape" : "0"
"URI::Escape" : "0",
"perl" : "5.016"
}
}
},
@@ -116,5 +117,5 @@
]
},
"version" : "v3.3.1",
"x_serialization_backend" : "JSON::PP version 2.94"
"x_serialization_backend" : "JSON::PP version 2.97000"
}
@@ -74,6 +74,7 @@ requires:
Text::ParseWords: '0'
Text::Wrap: '0'
URI::Escape: '0'
perl: '5.016'
resources:
license: http://dev.perl.org/licenses/
version: v3.3.1
@@ -1,4 +1,5 @@
# Note: this file was auto-generated by Module::Build::Compat version 0.4224
require 5.016;
use ExtUtils::MakeMaker;
WriteMakefile
(
@@ -15,7 +15,7 @@
#-------------------------------------------------------
# GTK YouTube Viewer
# Created on: 12 September 2010
# Latest edit on: 13 November 2017
# Latest edit on: 23 December 2017
# https://github.com/trizen/youtube-viewer
#-------------------------------------------------------

@@ -28,8 +28,6 @@ no warnings 'once';
my $DEVEL; # true in devel mode
use if ($DEVEL = 0), lib => qw(../lib); # devel only

no if $] >= 5.018, warnings => 'experimental::smartmatch';

use WWW::YoutubeViewer v3.3.1;
use WWW::YoutubeViewer::RegularExpressions;

@@ -691,8 +689,17 @@ if (not defined $CONFIG{video_player_selected}) {
}
}

if (not \%CONFIG ~~ $CONFIG) {
dump_configuration();
{
my $update_config = 0;

foreach my $key (keys %CONFIG) {
if (not exists $CONFIG->{$key}) {
$update_config = 1;
last;
}
}

dump_configuration() if $update_config;
}

# Locate a terminal
@@ -1437,7 +1444,7 @@ sub show_user_panel {

if (defined $info->{access_token}) {

$yv_obj->set_access_token($info->{access_token}) // return;
$yv_obj->set_access_token($info->{access_token}) // return;
$yv_obj->set_refresh_token($info->{refresh_token}) // return;

if ($gui->get_object('login_check_button')->get_active) {
@@ -1733,8 +1740,8 @@ sub main_window_state_events {
my $windowstate = $state->new_window_state();
my @states = split(' ', $windowstate);

$CONFIG{mainw_maximized} = 'maximized' ~~ \@states ? 1 : 0;
$CONFIG{mainw_fullscreen} = 'fullscreen' ~~ \@states ? 1 : 0;
$CONFIG{mainw_maximized} = (grep { $_ eq 'maximized' } @states) ? 1 : 0;
$CONFIG{mainw_fullscreen} = (grep { $_ eq 'fullscreen' } @states) ? 1 : 0;

return 1;
}
@@ -1960,8 +1967,8 @@ sub set_youtube_tops {
}

sub remove_selected_user {
my $selection = $users_treeview->get_selection // return;
my $iter = $selection->get_selected // return;
my $selection = $users_treeview->get_selection // return;
my $iter = $selection->get_selected // return;
my $channel_id = $users_liststore->get($iter, 0);
delete $channels{$channel_id};
$users_liststore->remove($iter);
@@ -1986,7 +1993,7 @@ sub set_youtube_tops {
# Get playlists from username
sub playlists_from_selected_username {
my $selection = $users_treeview->get_selection() // return;
my $iter = $selection->get_selected() // return;
my $iter = $selection->get_selected() // return;

my $type = $users_liststore->get($iter, 2);
my $channel = $users_liststore->get($iter, 0);
@@ -1996,7 +2003,7 @@ sub set_youtube_tops {

sub videos_from_selected_username {
my $selection = $users_treeview->get_selection() // return;
my $iter = $selection->get_selected() // return;
my $iter = $selection->get_selected() // return;

my $type = $users_liststore->get($iter, 2);
my $channel = $users_liststore->get($iter, 0);
@@ -2114,31 +2121,28 @@ sub get_selected_entry_code {
return wantarray ? ($code, $iter) : $code;
}

# Check if keywords are actually something else
sub check_keywords {
given ($_[0]) {
when (/$get_video_id_re/o) {
my $info = $yv_obj->video_details($+{video_id}, VIDEO_PART);
my ($key) = @_;

if ($yv_utils->has_entries($info)) {
if (not play_video($info->{results}{items}[0])) {
return;
}
}
else {
continue;
if ($key =~ /$get_video_id_re/o) {
my $info = $yv_obj->video_details($+{video_id}, VIDEO_PART);

if ($yv_utils->has_entries($info)) {
if (not play_video($info->{results}{items}[0])) {
return;
}
}
when (/$get_playlist_id_re/o) {
list_playlist($+{playlist_id});
}
when (/$get_course_id_re/) {
display_results($yv_obj->get_video_lectures_from_course($+{course_id}));
}
default {
else {
return;
}
}
elsif ($key =~ /$get_playlist_id_re/o) {
list_playlist($+{playlist_id});
}
else {
return;
}

return 1;
}

Oops, something went wrong.

0 comments on commit cfa326d

Please sign in to comment.
You can’t perform that action at this time.