SVN: toys/rsget.pl/RSGet: Dispatch.pm HTTPRequest.pm ListManager.pm

sparky sparky at pld-linux.org
Sun Oct 4 20:33:57 CEST 2009


Author: sparky
Date: Sun Oct  4 20:33:57 2009
New Revision: 10683

Modified:
   toys/rsget.pl/RSGet/Dispatch.pm
   toys/rsget.pl/RSGet/HTTPRequest.pm
   toys/rsget.pl/RSGet/ListManager.pm
Log:
- save/display quality information, useful if file size isn't known
- allow any service to return links


Modified: toys/rsget.pl/RSGet/Dispatch.pm
==============================================================================
--- toys/rsget.pl/RSGet/Dispatch.pm	(original)
+++ toys/rsget.pl/RSGet/Dispatch.pm	Sun Oct  4 20:33:57 2009
@@ -138,6 +138,8 @@
 		return $options if $options->{link1};
 	} else {
 		return $options if $options->{size} or $options->{asize};
+		return $options if $options->{quality};
+		return $options if $options->{link1};
 	}
 
 	run( "check", $uri, $getter, $options );

Modified: toys/rsget.pl/RSGet/HTTPRequest.pm
==============================================================================
--- toys/rsget.pl/RSGet/HTTPRequest.pm	(original)
+++ toys/rsget.pl/RSGet/HTTPRequest.pm	Sun Oct  4 20:33:57 2009
@@ -263,11 +263,20 @@
 		|| $o->{aname} || $o->{ainame};
 	$bestname = sgml( $bestname || "???" );
 
-	my $bestsize = $o->{size} ? bignum( $o->{size} ) . " bytes" : sgml( $o->{asize} || "?" );
+	my $bestsize = $o->{size} ? bignum( $o->{size} ) . " bytes" :
+		$o->{asize} ? sgml( $o->{asize} ) :
+		$o->{quality} ? sgml( $o->{quality} ) : "?";
+	if ( $o->{link1} ) {
+		$bestname = "Links";
+		my $i = 1;
+		$i++ while exists $o->{"link" . $i};
+		$i--;
+		$bestsize = $i;
+	}
 	my $uriid = makeid( $id_type, $uri, $uri );
 
 	my $color = "blue";
-	$color = "green" if $o->{size} or $o->{asize};
+	$color = "green" if $o->{size} or $o->{asize} or $o->{quality};
 	$color = "red" if $o->{error};
 	$color = "orange" if exists $RSGet::Dispatch::downloading{ $uri };
 

Modified: toys/rsget.pl/RSGet/ListManager.pm
==============================================================================
--- toys/rsget.pl/RSGet/ListManager.pm	(original)
+++ toys/rsget.pl/RSGet/ListManager.pm	Sun Oct  4 20:33:57 2009
@@ -109,16 +109,6 @@
 
 # }}}
 
-sub uri_obj
-{
-	my $line = shift;
-	my %resp;
-	foreach ( qw(uri get name size clone error links) ) {
-		$resp{ $_ } = $line->{ $_ } if exists $line->{ $_ };
-	}
-	return \%resp;
-}
-
 sub arr_exists
 {
 	my $arr = shift;
@@ -138,6 +128,7 @@
 	my $sn = simplify_name( $n );
 
 	my $s = $o->{fsize} || $o->{size} || $o->{asize};
+	$s ||= -1 if $o->{quality};
 	return () unless $s;
 	my $sr = size_to_range( $s, $o->{kilo} );
 
@@ -528,7 +519,7 @@
 
 		foreach my $uri ( sort keys %$uris ) {
 			my $o = $uris->{ $uri }->[1];
-			delete $uris->{ $uri } unless $o->{size} or $o->{asize};
+			delete $uris->{ $uri } unless $o->{size} or $o->{asize} or $o->{quality};
 		}
 
 		next unless keys %$uris;


More information about the pld-cvs-commit mailing list