SVN: toys/rsget.pl/Audio/Gazeta

sparky sparky at pld-linux.org
Thu Oct 7 15:01:34 CEST 2010


Author: sparky
Date: Thu Oct  7 15:01:34 2010
New Revision: 11833

Modified:
   toys/rsget.pl/Audio/Gazeta
Log:
- use GET befort INFO, this masks bug RSGETPL-44
- get file size from http headers


Modified: toys/rsget.pl/Audio/Gazeta
==============================================================================
--- toys/rsget.pl/Audio/Gazeta	(original)
+++ toys/rsget.pl/Audio/Gazeta	Thu Oct  7 15:01:34 2010
@@ -13,12 +13,19 @@
 status: OK 2010-09-19
 
 unify:
+	# don't remove #/.*
 	return $_;
+
 start:
-	my $fname = uri_unescape( $1 ).".mp3"
-		if $-{_uri} =~ /\/([^\/]+?)(?:\.mp3)?$/;
+	GET( $-{_uri}, headonly => 1 );
+
+	my ( $len ) = /^Content-Length:\s*(\d+)\r?$/mi;
+	$len ||= -1;
+
+	! $-{_uri} =~ m{#/([^/]+?)(?:\.mp3)?$};
+	my $fname = uri_unescape( $1 ) . ".mp3";
 
-	INFO( name => $fname, quality => "mp3" );
+	INFO( name => $fname, size => $len, quality => "mp3" );
 
 	DOWNLOAD( $-{_uri}, fname => $fname );
 


More information about the pld-cvs-commit mailing list