Change new() function in plugins to avoid having to call _prepare_parameters() in...
authorRalf Ertzinger <ralf@skytale.net>
Sun, 21 Apr 2013 17:32:48 +0000 (19:32 +0200)
committerRalf Ertzinger <ralf@skytale.net>
Sun, 21 Apr 2013 17:32:48 +0000 (19:32 +0200)
31 files changed:
videosite/AsyncFileGetter.pm
videosite/AsyncWgetFileGetter.pm
videosite/Base.pm
videosite/BlipTVGrabber.pm
videosite/BreakGrabber.pm
videosite/BroadcasterGrabber.pm
videosite/CollegeHumorGrabber.pm
videosite/DailyMotionGrabber.pm
videosite/DoubleVikingGrabber.pm
videosite/FileGetter.pm
videosite/GetterBase.pm
videosite/GoogleGrabber.pm
videosite/GrabberBase.pm
videosite/HTTPJSONGetter.pm
videosite/HTTPRPCGetter.pm
videosite/LiveLeakGrabber.pm
videosite/MNCastGrabber.pm
videosite/MetaCafeGrabber.pm
videosite/MotherlessGrabber.pm
videosite/MyVideoGrabber.pm
videosite/NullGetter.pm
videosite/RedTubeGrabber.pm
videosite/SevenloadGrabber.pm
videosite/SnotrGrabber.pm
videosite/SpikedHumorGrabber.pm
videosite/VeohGrabber.pm
videosite/VimeoGrabber.pm
videosite/WimpGrabber.pm
videosite/YahooGrabber.pm
videosite/YouTubeGrabber.pm
videosite/ZeroPunctuationGrabber.pm

index 984597d..4250bf4 100644 (file)
@@ -20,14 +20,11 @@ use MIME::Base64;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'asyncfilegetter',
+    );
 
-    $self->{'NAME'} = 'asyncfilegetter';
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub get {
index d52a2ef..fd8c5f9 100644 (file)
@@ -20,14 +20,11 @@ use MIME::Base64;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'asyncwgetfilegetter',
+    );
 
-    $self->{'NAME'} = 'asyncwgetfilegetter';
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub get {
index f6108f6..606d6f4 100644 (file)
@@ -15,6 +15,7 @@ sub new {
                 '_CONNECTORS' => sub { return ({ 'name' => 'direct',
                                                  'schemas' => {} }) },
                 '_CONNECTOR' => undef,
+                @_,
                };
     
     bless($self, $class);
index 2a48541..20dc0d5 100644 (file)
@@ -16,17 +16,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'bliptv';
-    $self->{_SELFTESTURL} = 'http://blip.tv/rebelliouspixelscom/buffy-vs-edward-twilight-remixed-2274024';
-    $self->{_SELFTESTTITLE} = 'Buffy vs Edward (Twilight Remixed)';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*blip.tv/\S+/\S+)'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'bliptv',
+        _SELFTESTURL => 'http://blip.tv/rebelliouspixelscom/buffy-vs-edward-twilight-remixed-2274024',
+        _SELFTESTTITLE => 'Buffy vs Edward (Twilight Remixed)',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*blip.tv/\S+/\S+)'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 0896078..6e4d02f 100644 (file)
@@ -15,16 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'break',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*break.com/index/([-a-zA-Z0-9_]+?)\.html)'],
+    );
 
-    $self->{'NAME'} = 'break';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*break.com/index/([-a-zA-Z0-9_]+?)\.html)'];
-
-    bless($self, $class);
-
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index 5891acb..8e18e12 100644 (file)
@@ -15,15 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'broadcaster',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*broadcaster\.com/clip/(\d+))'],
+    );
 
-    $self->{'NAME'} = 'broadcaster';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*broadcaster\.com/clip/(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index 7fb3cae..1e20d69 100644 (file)
@@ -16,18 +16,15 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'collegehumor';
-    $self->{_SELFTESTURL} = 'http://www.collegehumor.com/video/5635400/pixar-intro-parody';
-    $self->{_SELFTESTTITLE} = 'Pixar Intro Parody';
-    $self->{'PATTERNS'} = ['(http://www.collegehumor.com/video:(\d+))',
-                           '(http://www.collegehumor.com/video/(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'collegehumor',
+        _SELFTESTURL => 'http://www.collegehumor.com/video/5635400/pixar-intro-parody',
+        _SELFTESTTITLE => 'Pixar Intro Parody',
+        PATTERNS => ['(http://www.collegehumor.com/video:(\d+))',
+                     '(http://www.collegehumor.com/video/(\d+))'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 6544882..aa7d279 100644 (file)
@@ -16,16 +16,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'dailymotion',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*dailymotion.com/(?:[^/]+/)*video/([-a-zA-Z0-9_]+))'],
+    );
 
-    $self->{'NAME'} = 'dailymotion';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*dailymotion.com/(?:[^/]+/)*video/([-a-zA-Z0-9_]+))'];
-
-    bless($self, $class);
-
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index e79c261..81ba370 100644 (file)
@@ -15,15 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'doubleviking',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*doubleviking.com/videos/(?:[-a-zA-Z0-9_ %]+/)*page0\.html/(\d+)\.html$)'],
+    );
 
-    $self->{'NAME'} = 'doubleviking';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*doubleviking.com/videos/(?:[-a-zA-Z0-9_ %]+/)*page0\.html/(\d+)\.html$)'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index f7c680e..0d2b250 100644 (file)
@@ -14,15 +14,15 @@ use File::Basename;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'filegetter';
-    $self->{'_PARAMS'} = {'MINFREE' => ['500000', 'The amount of space that needs to be available on the filesystem before the video is downloaded (in kilobytes)'], 'FILEPATTERN', => ['/tmp/%s - %s - %s.flv', "The file name to save the file under. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are encoded (space and / replaced by _)"]};
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'filegetter',
+        _PARAMS => {
+            MINFREE => ['500000', 'The amount of space that needs to be available on the filesystem before the video is downloaded (in kilobytes)'],
+            FILEPATTERN => ['/tmp/%s - %s - %s.flv', "The file name to save the file under. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are encoded (space and / replaced by _)"]
+        },
+    );
+
+    return bless($self, $class);
 }
 
 sub get {
index c7d56de..52e8a4d 100644 (file)
@@ -10,12 +10,11 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self = {%{$self},
+    my $self = $class->SUPER::new(
         NAME => 'FlashGetter',
-        TYPE => 'getter'
-    };
+        TYPE => 'getter',
+        @_,
+    );
 
     return bless($self, $class);
 }
index 4915603..665fc44 100644 (file)
@@ -15,16 +15,15 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'google';
-    $self->{'PATTERNS'} = ['(http://video\.google\.com/videoplay\?docid=([-\d]+))'];
-    $self->{'_PARAMS'} = {'QUALITY' => ['normal', 'Quality of the video to download. normal = standard resolution flash video, h264 = high resolution MPEG4 video']};
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'google',
+        PATTERNS => ['(http://video\.google\.com/videoplay\?docid=([-\d]+))'],
+        _PARAMS => {
+            QUALITY => ['normal', 'Quality of the video to download. normal = standard resolution flash video, h264 = high resolution MPEG4 video']
+        },
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 44bde35..576d7e4 100644 (file)
@@ -11,13 +11,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self = {%{$self},
+    my $self = $class->SUPER::new(
         NAME => 'FlashGrab',
         TYPE => 'grabber',
         PATTERNS => [],
-    };
+        @_,
+    );
     return bless($self, $class);
 }
 
index 87a6d83..0c409a9 100644 (file)
@@ -14,15 +14,14 @@ use JSON -support_by_pp;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'HTTPJSONGetter';
-    $self->{'_PARAMS'} = {'URL' => ['http://www.example.com/getjson.pl', "The URL to call in order to trigger a download. The JSON encoded information will be POSTed to this URL."]};
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'HTTPJSONGetter',
+        _PARAMS => {
+            URL => ['http://www.example.com/getjson.pl', "The URL to call in order to trigger a download. The JSON encoded information will be POSTed to this URL."]
+        },
+    );
+
+    return bless($self, $class);
 }
 
 sub get {
index 16ef726..fb0fd95 100644 (file)
@@ -14,15 +14,14 @@ use LWP::Simple qw(!get);
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'HTTPRPCGetter';
-    $self->{'_PARAMS'} = {'URL' => ['http://www.example.com/get.pl?type=%s&vid=%s&title=%s&url=%s', "The URL to call in order to trigger a download. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are hexencoded"]};
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'HTTPRPCGetter',
+        _PARAMS => {
+            URL => ['http://www.example.com/get.pl?type=%s&vid=%s&title=%s&url=%s', "The URL to call in order to trigger a download. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are hexencoded"]
+        },
+    );
+
+    return bless($self, $class);
 }
 
 sub get {
index 27f4c7f..b0d6fee 100644 (file)
@@ -15,15 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'liveleak',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*liveleak.com/view\?i=([^\&]+))'],
+    );
 
-    $self->{'NAME'} = 'liveleak';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*liveleak.com/view\?i=([^\&]+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index 19c1969..7b12e03 100644 (file)
@@ -16,15 +16,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'mncast',
+        PATTERNS => ['(http://www\.mncast\.com/\?(\d+))'],
+    );
 
-    $self->{'NAME'} = 'mncast';
-    $self->{'PATTERNS'} = ['(http://www\.mncast\.com/\?(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index e134bec..e7f51d5 100644 (file)
@@ -15,16 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'metacafe',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*metacafe.com/watch/(\d+)(?:\S+)?)'],
+    );
 
-    $self->{'NAME'} = 'metacafe';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*metacafe.com/watch/(\d+)(?:\S+)?)'];
-
-    bless($self, $class);
-
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index bbbe1a8..0b24870 100644 (file)
@@ -17,17 +17,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'motherless';
-    $self->{_SELFTESTURL} = 'http://motherless.com/4976432';
-    $self->{_SELFTESTTITLE} = 'Teen masturbation in shower';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*motherless.com/([a-zA-Z0-9]+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'motherless',
+        _SELFTESTURL => 'http://motherless.com/4976432',
+        _SELFTESTTITLE => 'Teen masturbation in shower',
+        _PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*motherless.com/([a-zA-Z0-9]+))'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 3028466..e908ebd 100644 (file)
@@ -15,15 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'myvideo',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*myvideo.de/watch/(\d+))'],
+    );
 
-    $self->{'NAME'} = 'myvideo';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*myvideo.de/watch/(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index 28e62f5..27aa76e 100644 (file)
@@ -14,14 +14,11 @@ use LWP::Simple qw(!get);
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'nullgetter',
+    );
 
-    $self->{'NAME'} = 'nullgetter';
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub get {
index df01837..0966ca9 100644 (file)
@@ -18,17 +18,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'redtube';
-    $self->{_SELFTESTURL} = 'http://www.redtube.com/8269';
-    $self->{_SELFTESTTITLE} = 'Porn bloopers with pretty girl';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*redtube.com/(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'redtube',
+        _SELFTESTURL => 'http://www.redtube.com/8269',
+        _SELFTESTTITLE => 'Porn bloopers with pretty girl',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*redtube.com/(\d+))'],
+    );
+
+    return bless($self, $class);
 }
 
 sub div($$) {
index 4d3482f..897b24b 100644 (file)
@@ -15,17 +15,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'sevenload';
-    $self->{_SELFTESTURL} = 'http://de.sevenload.com/videos/uqDvKzh-vilogo-TV-Spot';
-    $self->{_SELFTESTTITLE} = 'vilogo TV-Spot';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*sevenload.com/videos/(\w+?)-.*)'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'sevenload',
+        _SELFTESTURL => 'http://de.sevenload.com/videos/uqDvKzh-vilogo-TV-Spot',
+        _SELFTESTTITLE => 'vilogo TV-Spot',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*sevenload.com/videos/(\w+?)-.*)'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 3009995..9f4e857 100644 (file)
@@ -15,17 +15,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'snotr';
-    $self->{_SELFTESTURL} = 'http://www.snotr.com/video/1836';
-    $self->{_SELFTESTTITLE} = 'Brilliant thief';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*snotr\.com/video/(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'snotr',
+        _SELFTESTURL => 'http://www.snotr.com/video/1836',
+        _SELFTESTTITLE => 'Brilliant thief',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*snotr\.com/video/(\d+))'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 5d0f6ae..b903ad8 100644 (file)
@@ -15,15 +15,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'spikedhumor',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*spikedhumor.com/articles/(\d+)(?:/.*)*)'],
+    );
 
-    $self->{'NAME'} = 'spikedhumor';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*spikedhumor.com/articles/(\d+)(?:/.*)*)'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index dda2b5d..1b118d1 100644 (file)
@@ -14,17 +14,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'veoh';
-    $self->{_SELFTESTURL} = 'http://www.veoh.com/watch/v18348952fyn2twbe';
-    $self->{_SELFTESTTITLE} = '518_2 kureyon shinchan';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*veoh.com/+watch/(\w+)\??)'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'veoh',
+        _SELFTESTURL => 'http://www.veoh.com/watch/v18348952fyn2twbe',
+        _SELFTESTTITLE => '518_2 kureyon shinchan',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*veoh.com/+watch/(\w+)\??)'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index 9b2b689..e39c494 100644 (file)
@@ -16,17 +16,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'vimeo';
-    $self->{_SELFTESTURL} = 'http://vimeo.com/35055590';
-    $self->{_SELFTESTTITLE} = 'Hello';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*vimeo.com/(?:m/)?(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'vimeo',
+        _SELFTESTURL => 'http://vimeo.com/35055590',
+        _SELFTESTTITLE => 'Hello',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*vimeo.com/(?:m/)?(\d+))'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index e9b14ff..a09a39e 100644 (file)
@@ -16,18 +16,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'wimp';
-    $self->{_SELFTESTURL} = 'http://www.wimp.com/insanebuilding/';
-    $self->{_SELFTESTTITLE} = 'Insane building.';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*wimp.com/([^/]+)/?)'];
-
-    bless($self, $class);
-
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'wimp',
+        _SELFTESTURL => 'http://www.wimp.com/insanebuilding/',
+        _SELFTESTTITLE => 'Insane building.',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*wimp.com/([^/]+)/?)'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index fc88043..44715f9 100644 (file)
@@ -16,15 +16,12 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
+    my $self = $class->SUPER::new(
+        NAME => 'yahoo',
+        PATTERNS => ['(http://video\.yahoo\.com/watch/\d+/(\d+))'],
+    );
 
-    $self->{'NAME'} = 'yahoo';
-    $self->{'PATTERNS'} = ['(http://video\.yahoo\.com/watch/\d+/(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    return bless($self, $class);
 }
 
 sub _parse {
index 10b1c2e..59d748b 100644 (file)
@@ -53,34 +53,32 @@ my %videoformats = (
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'youtube';
-    $self->{_SELFTESTURL} = 'http://www.youtube.com/watch?v=dMH0bHeiRNg';
-    $self->{_SELFTESTTITLE} = 'Evolution of Dance - By Judson Laipply';
-    $self->{'PATTERNS'} = ['(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch(?:_popup)?\?.*?v=([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch\#\!v=([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/v/([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/embed/([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/[[:alnum:]]+\?v=([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/(?:user/)?[[:alnum:]]+#p/(?:\w+/)+\d+/([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/watch\?v=([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/([-a-zA-Z0-9_]+))',
-                           '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/\w+\?.*/([-a-zA-Z0-9_]+))'];
-    $self->{'_PARAMS'} = {
-            'QUALITY' => ['normal', 'Quality of the video to download.', {
-                    'normal' => 'standard resolution flash video',
-                    'high' => 'higher resolution flash video',
-                    'h264' => 'high resolution MPEG4 video',
-                    'hd' => 'HD720 resolution'}],
-            'USERNAME' => ['', 'Username to use for YouTube login'],
-            'PASSWORD' => ['', 'Password to use for YouTube login'],
-            'HTTPS' => [1, 'Whether to use HTTPS (if available) to connect to YouTube']};
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'youtube',
+        _SELFTESTURL => 'http://www.youtube.com/watch?v=dMH0bHeiRNg',
+        _SELFTESTTITLE => 'Evolution of Dance - By Judson Laipply',
+        PATTERNS => ['(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch(?:_popup)?\?.*?v=([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch\#\!v=([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/v/([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/embed/([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/[[:alnum:]]+\?v=([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/(?:user/)?[[:alnum:]]+#p/(?:\w+/)+\d+/([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/watch\?v=([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/([-a-zA-Z0-9_]+))',
+                     '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/\w+\?.*/([-a-zA-Z0-9_]+))'],
+        _PARAMS => {
+            QUALITY => ['normal', 'Quality of the video to download.', {
+                           normal => 'standard resolution flash video',
+                           high => 'higher resolution flash video',
+                           h264 => 'high resolution MPEG4 video',
+                           hd => 'HD720 resolution'}],
+            USERNAME => ['', 'Username to use for YouTube login'],
+            PASSWORD => ['', 'Password to use for YouTube login'],
+            HTTPS => [1, 'Whether to use HTTPS (if available) to connect to YouTube']
+        },
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
index a9538fe..241f4b6 100644 (file)
@@ -16,17 +16,14 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'zeropunctuation';
-    $self->{_SELFTESTURL} = 'http://www.escapistmagazine.com/videos/view/zero-punctuation/5346-Amy';
-    $self->{_SELFTESTTITLE} = 'Amy';
-    $self->{'PATTERNS'} = ['(http://www.escapistmagazine.com/videos/view/zero-punctuation/([-A-Za-z0-9]+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'zeropunctuation',
+        _SELFTESTURL => 'http://www.escapistmagazine.com/videos/view/zero-punctuation/5346-Amy',
+        _SELFTESTTITLE =>'Amy',
+        PATTERNS => ['(http://www.escapistmagazine.com/videos/view/zero-punctuation/([-A-Za-z0-9]+))'],
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {