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

sparky sparky at pld-linux.org
Tue Jul 20 18:49:54 CEST 2010


Author: sparky
Date: Tue Jul 20 18:49:54 2010
New Revision: 11686

Modified:
   toys/rsget.pl/RSGet/HTTPRequest.pm
   toys/rsget.pl/RSGet/Main.pm
Log:
- added http_outdir option


Modified: toys/rsget.pl/RSGet/HTTPRequest.pm
==============================================================================
--- toys/rsget.pl/RSGet/HTTPRequest.pm	(original)
+++ toys/rsget.pl/RSGet/HTTPRequest.pm	Tue Jul 20 18:49:54 2010
@@ -235,6 +235,9 @@
 		ADD => "orange",
 	);
 
+	my $out_uri = setting( "http_outdir" );
+	my $out_dir = setting( "outdir" );
+
 	$main_ids{file} = {};
 	$main_ids{uri} = {};
 	$r .= '<ul class="flist">';
@@ -259,6 +262,13 @@
 		$r .= qq#<li id="$fileid" class="file $color">#;
 		my $size = $g->{fsize} ? bignum( $g->{fsize} ) : "?";
 		my $fname = $g->{fname} ? sgml( $g->{fname} ) : "???";
+		if ( $out_uri and $cmd eq "DONE" ) {
+			my $file = "/" . $g->{fname};
+			$file = "/" . $g->{dir} . $file if $g->{dir};
+			if ( -r $out_dir . $file ) {
+				$fname = '<a href="' . sgml( $out_uri . $file ) . '">' . $fname . '</a>';
+			}
+		}
 		$r .= qq#<div class="info"><span class="cmd">$cmd</span><span class="size">$size bytes</span>$fname</div>#;
 
 		$r .= '<div class="tools">' . (join " | ", map "<span>$_</span>", @tools) . '</div>';
@@ -353,6 +363,7 @@
 	s/&/&amp;/g;
 	s/</&lt;/g;
 	s/>/&gt;/g;
+	s/"/&quot;/g;
 	s#\0#<small>(???)</small>#g;
 	return $_;
 }

Modified: toys/rsget.pl/RSGet/Main.pm
==============================================================================
--- toys/rsget.pl/RSGet/Main.pm	(original)
+++ toys/rsget.pl/RSGet/Main.pm	Tue Jul 20 18:49:54 2010
@@ -34,6 +34,11 @@
 		desc => "HTTP password, as plain text, user is 'root'.",
 		allowed => qr/\S+/,
 	},
+	http_outdir => {
+		desc => "URI to outdir. Useful if you have some http server with"
+			. " access to your downloaded files.",
+		allowed => qr{\S+},
+	},
 	verbose => {
 		desc => "Verbosity level.",
 		default => 0,


More information about the pld-cvs-commit mailing list