version 1.1, 2005/03/24 00:22:09 |
version 1.6, 2005/03/29 00:28:50 |
|
|
|
|
%ENV = (); |
%ENV = (); |
|
|
use YAML; |
#use YAML; |
|
|
|
justme(); |
|
|
my $url_torrents = 'http://openbsd.somedomain.net/dumptorrents.php'; |
my $url_torrents = 'http://openbsd.somedomain.net/dumptorrents.php'; |
my $url_upload = 'http://openbsd.somedomain.net/newtorrents.php'; |
my $url_upload = 'http://openbsd.somedomain.net/newtorrents.php'; |
my $url_delete = 'http://openbsd.somedomain.net/deltorrents.php'; |
my $url_delete = 'http://openbsd.somedomain.net/deltorrents.php'; |
|
my $url_sanity = 'http://openbsd.somedomain.net/sanity.php'; |
|
|
my $user = 'torrentup'; |
my $user = 'torrentup'; |
my $pass = 'ssapword'; |
my $pass = 'ssapword'; |
|
|
|
my @Sizes = ('', 'Ki', 'Mi', 'Gi', 'Ti'); |
my $ua = LWP::UserAgent->new; |
my $ua = LWP::UserAgent->new; |
|
|
my $response = $ua->get($url_torrents); |
my $response = $ua->get($url_torrents); |
|
|
} |
} |
|
|
foreach my $file (keys %server_torrents) { |
foreach my $file (keys %server_torrents) { |
unless (exists $files{$file}) { |
my ($name, $year, $mon, $mday, $hour, $min) = |
|
$file =~ |
|
/^(.*)-(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})/; |
|
unless (exists $files{$name}) { |
Delete_Torrent($file); |
Delete_Torrent($file); |
} |
} |
} |
} |
|
|
|
$ua->get($url_sanity); |
|
|
sub Upload_Torrent |
sub Upload_Torrent |
{ |
{ |
|
|
return undef; |
return undef; |
} |
} |
|
|
|
my $size = $t->total_size; |
|
|
|
my $i; |
|
while ($size > 1024) { |
|
$size /= 1024; |
|
$i++; |
|
} |
|
$size = sprintf('%.2f', $size); |
|
$size .= $Sizes[$i] . 'B'; |
|
|
my $comment = $t->{comment}; |
my $comment = $t->{comment}; |
$comment =~ s/\n.*$//s; |
$comment =~ s/\n.*$//s; |
|
|
my ($filename) = $comment =~ /Files from ([^<]+)/; |
my ($filename) = $comment =~ /Files from (.+)/; |
$filename =~ s#/# #g; |
$filename =~ s#/# #g; |
|
|
$filename .= ' (' . $time . ')'; |
$comment .= " [$size]"; |
|
$filename .= " [$time]"; |
|
|
my $response = $ua->post($url_upload, { |
my $response = $ua->post($url_upload, { |
username => $user, |
username => $user, |
|
|
}, Content_Type => 'form-data'); |
}, Content_Type => 'form-data'); |
|
|
if ($response->is_success) { |
if ($response->is_success) { |
print "Uploaded $file\n"; |
print STDERR "Uploaded $file\n"; |
#print $response->content; |
#print $response->content; |
} else { |
} else { |
die $response->status_line; |
die $response->status_line; |