SVN: toys/rsget.pl/RSGet: Main.pm Plugin.pm

sparky sparky at pld-linux.org
Sat Jun 26 16:57:45 CEST 2010


Author: sparky
Date: Sat Jun 26 16:57:45 2010
New Revision: 11586

Modified:
   toys/rsget.pl/RSGet/Main.pm
   toys/rsget.pl/RSGet/Plugin.pm
Log:
- added support for Direct downloaders


Modified: toys/rsget.pl/RSGet/Main.pm
==============================================================================
--- toys/rsget.pl/RSGet/Main.pm	(original)
+++ toys/rsget.pl/RSGet/Main.pm	Sat Jun 26 16:57:45 2010
@@ -260,7 +260,7 @@
 		unshift @paths, $main::local_path;
 	}
 	foreach my $path ( @paths ) {
-		foreach my $type ( qw(Get Video Audio Image Link) ) {
+		foreach my $type ( qw(Get Video Audio Image Link Direct) ) {
 			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	Sat Jun 26 16:57:45 2010
@@ -210,8 +210,14 @@
 	my $self = shift;
 	my $uri = shift;
 
-	foreach my $re ( @{ $self->{urire} } ) {
-		return 1 if $uri =~ m{^http://(?:www\.)?$re};
+	if ( $self->{class} eq "Direct" ) {
+		foreach my $re ( @{ $self->{urire} } ) {
+			return 1 if $uri =~ m{^$re$};
+		}
+	} else {
+		foreach my $re ( @{ $self->{urire} } ) {
+			return 1 if $uri =~ m{^http://(?:www\.)?$re};
+		}
 	}
 	return 0;
 }
@@ -271,13 +277,18 @@
 	if ( $from_uri_last ) {
 		return $from_uri_last if $from_uri_last->can_do( $uri );
 	}
+	my $direct = undef;
 	foreach my $getter ( values %getters ) {
 		if ( $getter->can_do( $uri ) ) {
-			$from_uri_last = $getter;
-			return $getter;
+			if ( $getter->{class} eq "Direct" ) {
+				$direct = $getter;
+			} else {
+				$from_uri_last = $getter;
+				return $getter;
+			}
 		}
 	}
-	return undef;
+	return $direct;
 }
 
 sub from_pkg


More information about the pld-cvs-commit mailing list