# $Id: SendSpacePL 11671 2010-07-14 16:44:54Z sparky $
# Get::SendSpacePL - File getter plugin for rsget.pl
#
# 2009-2010 (c) Przemysław Iskra <sparky@pld-linux.org>
#		This program is free software,
# you may distribute it under GPL v2 or newer.

name: SendSpacePL
short: SS.pl
web: "http://www.sendspace.pl/"
tos: "http://www.sendspace.pl/informacje/regulamin"
uri: qr{sendspace\.pl/file/[a-zA-Z0-9]{8}}
cookie: ss.pl
status: OK 2010-07-14

start:
	GET( $-{_uri} );

	ERROR( "file not found" )
		if /Podany plik nie istnieje lub został usunięty./;

	! m#<div class="text"><span class="black3">Nazwa pliku:</span></div>\s*<div class="info"><a href="(.*?)".*?><b>(.*?)</b></a></div>#s;
	my $file_uri = $1;
	my $name = $2;
	$name =~ s/\.\.\.$/\0/;

	! m#<div class="text"><span class="black3">Rozmiar pliku:</span></div>\s*<div class="info"><span class="blue4">([\d,]+ MB)</span></div>#s;
	my $size = $1;
	$size =~ s/,/\./;

	INFO( name => $name, asize => $size );

	CLICK_DOWNLOAD( $file_uri );

	DELAY( 5 * 60, "temporarily unavailable" ) if /jest chwilowo niedostępny/;
	RESTART( $1, "free limit reached" ) if /setDownloadTimeOut\('(\d+)'\);/;

# vim: filetype=perl:ts=4:sw=4
