[SCM] Video extraction utility for YouTube, Google Video and other video sites (Debian packaging) branch, master, updated. upstream/2.1.7-214-g6762190

legatvs legatvs at gmail.com
Wed Apr 1 14:45:16 UTC 2009


The following commit has been merged in the master branch:
commit c40dd1c063702329694a7721fb29f6a58afec727
Author: legatvs <legatvs at gmail.com>
Date:   Sun Mar 22 16:21:47 2009 +0200

    Relocate "require $mod".

diff --git a/clive b/clive
index df54ff1..6e86c74 100755
--- a/clive
+++ b/clive
@@ -21,29 +21,27 @@
 use warnings;
 use strict;
 
-binmode(STDOUT, ":utf8");
+use constant VERSION             => "2.1.8";
+use constant MBDIV               => 0x100000;
+use constant SHOWFMT_DEFAULT     => qq/%D: "%t" | %mMB/;
 
+binmode(STDOUT, ":utf8");
 # NOTE: Using "require" instead of "use" causes "Can't locate
 # auto/WWW/Curl/CURLOPT_USE.al in @INC".
 use WWW::Curl::Easy 4.05;
-
-# Core modules:
 use Getopt::Long qw(:config bundling);
 use Cwd qw(getcwd);
+use Config::Tiny;
 use File::Spec;
 use Encode;
 
-use constant VERSION             => "2.1.8";
-use constant MBDIV               => 0x100000;
-use constant SHOWFMT_DEFAULT     => qq/%D: "%t" | %mMB/;
-
 # Non-essential modules: set flags indicating availability
 my %opted_mods = (Clipboard => 1, Expect => 1, IOPager => 1, ReadKey => 1);
-eval "use Clipboard;";      $opted_mods{Clipboard}  = 0 if $@;
-eval "use IO::Pager;";      $opted_mods{IOPager}    = 0 if $@;
+eval "use Clipboard";      $opted_mods{Clipboard}  = 0 if $@;
+eval "use IO::Pager";      $opted_mods{IOPager}    = 0 if $@;
 sub exp_continue() {}; # Satisfies: "Bareword "exp_continue" not allowed while"
-eval "use Expect;";         $opted_mods{Expect}     = 0 if $@;
-eval "use Term::ReadKey;";  $opted_mods{ReadKey}    = 0 if $@;
+eval "use Expect";         $opted_mods{Expect}     = 0 if $@;
+eval "use Term::ReadKey";  $opted_mods{ReadKey}    = 0 if $@;
 
 my $CONFIGDIR   = $ENV{CLIVE_HOME}
     || File::Spec->catfile($ENV{HOME}, ".config/clive");
@@ -84,8 +82,6 @@ my %re_hosts = (    # Precompiled regex used to identify the host
 );
 
 # Parse config
-require Config::Tiny;
-
 my $c = Config::Tiny->read($CONFIGFILE);
 %opts = (
     progress    => $c->{_}->{progress},
@@ -230,6 +226,10 @@ sub process_queue {
     init_curl();
 
     require Digest::SHA;
+    require HTML::TokeParser;
+    require URI::Escape;
+    require File::Basename;
+    require POSIX;
 
     foreach ( @queue ) {
         $hash = Digest::SHA::sha1_hex($_);
@@ -305,14 +305,10 @@ sub process_page {
 
     $$response_ref =~ tr{\n}//d;
 
-    require HTML::TokeParser;
-
     my $p = HTML::TokeParser->new($response_ref);
     $p->get_tag("title");
     my $title = $p->get_trimmed_text;
 
-    require URI::Escape;
-
     my ($xurl, $id);
     if      ( $url =~ /$re_hosts{IsYoutube}/ ) {
         ($xurl, $id) = handle_youtube($response_ref);
@@ -599,8 +595,6 @@ sub parse_input {
 
     chomp $url;
 
-    require URI::Escape;
-
     if ( $url =~ /&srcurl=(.*?)&/ ) { # GVideo: one of many redirects
         printf "found redirect ...%s\n=> %s\n",
             (split(/&/,$url))[0],
@@ -1033,7 +1027,6 @@ sub bar_update {
         $fname_len += $bp{width} - DEFAULT_TERM_WIDTH;
     }
 
-    require File::Basename;
     my $buffer =
         substr(File::Basename::basename($curr_fpath), 0, $fname_len);
 
@@ -1402,8 +1395,6 @@ sub title_to_filename {
     my @a = split(/\./,$authority);
 
     my $fn          = $opts{fnfmt} || "%t_%d_%i.%s";
-
-    require POSIX;
     my $timestamp   = POSIX::strftime("%F %T",localtime);
 
     my %h = (
@@ -1538,7 +1529,7 @@ sub fetch_entry {
 sub save_entry {
     my @values;
 
-    $entry{time_stamp} = strftime("%F %T",localtime);
+    $entry{time_stamp} = POSIX::strftime("%F %T",localtime);
 
     push @values,$entry{$_}
         foreach sort keys %entry;

-- 
Video extraction utility for YouTube, Google Video and other video sites (Debian packaging)



More information about the Pkg-perl-cvs-commits mailing list