Author: sparky
Date: Mon Dec  6 00:37:19 2010
New Revision: 11950

Modified:
   toys/rsget.pl/RSGet/Main.pm
   toys/rsget.pl/RSGet/Plugin.pm
Log:
- hack-in support for premium plugins, not very pretty, but works


Modified: toys/rsget.pl/RSGet/Main.pm
==============================================================================
--- toys/rsget.pl/RSGet/Main.pm (original)
+++ toys/rsget.pl/RSGet/Main.pm Mon Dec  6 00:37:19 2010
@@ -191,6 +191,7 @@
        my $user = shift;
        my $die = 0;
        foreach my $s ( sort keys %$settings ) {
+               next if $s =~ /^premium_/;
                my $v = $settings->{ $s };
                my $def = $main::def_settings{ $s };
                unless ( $def ) {
@@ -292,8 +293,8 @@
        if ( setting( "use_svn" ) eq "yes" ) {
                unshift @paths, $main::local_path;
        }
-       foreach my $path ( @paths ) {
-               foreach my $type ( qw(Get Video Audio Image Link Direct) ) {
+       foreach my $type ( qw(Premium Get Video Audio Image Link Direct) ) {
+               foreach my $path ( @paths ) {
                        my $dir = "$path/$type";
                        next unless -d $dir;
                        my $count = 0;

Modified: toys/rsget.pl/RSGet/Plugin.pm
==============================================================================
--- toys/rsget.pl/RSGet/Plugin.pm       (original)
+++ toys/rsget.pl/RSGet/Plugin.pm       Mon Dec  6 00:37:19 2010
@@ -11,6 +11,7 @@
 use RSGet::Tools;
 set_rev qq$Id$;
 
+my @getters;
 my %getters;
 
 sub read_file($)
@@ -258,9 +259,24 @@
        return 0 if m{/\.[^/]*$};
        ( my $file = $_ ) =~ s#.*/##;
        return 0 if exists $getters{ $type . "::" . $file };
+       if ( $type eq "Premium" ) {
+               my $opt = "premium_" . lc $file;
+               def_settings(
+                       $opt => {
+                               desc => "Premium account information for 
${type}/$file",
+                       }
+               );
+
+               unless ( setting( $opt ) ) {
+                       warn "${type}/$file: $opt option must be set for this 
plugin; failed\n"
+                               if verbose( 2 );
+                       return 0;
+               }
+       }
        my $plugin = new RSGet::Plugin( $type, $_ );
        if ( $plugin ) {
                my $pkg = $plugin->{pkg};
+               push @getters, $plugin;
                $getters{ $pkg } = $plugin;
                new RSGet::Line( "INIT: ", "$pkg: Added" )
                        if verbose( 2 );
@@ -280,7 +296,7 @@
                return $from_uri_last if $from_uri_last->can_do( $uri );
        }
        my $direct = undef;
-       foreach my $getter ( values %getters ) {
+       foreach my $getter ( @getters ) {
                if ( $getter->can_do( $uri ) ) {
                        if ( $getter->{class} eq "Direct" ) {
                                $direct = $getter;
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to