=================================================================== RCS file: /cvs/openbsd/OpenBSDTorrents/ServerTorrents.pl,v retrieving revision 1.3 retrieving revision 1.8 diff -u -r1.3 -r1.8 --- openbsd/OpenBSDTorrents/ServerTorrents.pl 2005/03/24 19:49:51 1.3 +++ openbsd/OpenBSDTorrents/ServerTorrents.pl 2005/04/01 01:20:15 1.8 @@ -1,5 +1,5 @@ #!/usr/bin/perl -T -#$Id: ServerTorrents.pl,v 1.3 2005/03/24 19:49:51 andrew Exp $ +#$Id: ServerTorrents.pl,v 1.8 2005/04/01 01:20:15 andrew Exp $ use strict; use warnings; use diagnostics; @@ -13,12 +13,14 @@ %ENV = (); +#use YAML; -use YAML; +justme(); my $url_torrents = 'http://openbsd.somedomain.net/dumptorrents.php'; my $url_upload = 'http://openbsd.somedomain.net/newtorrents.php'; my $url_delete = 'http://openbsd.somedomain.net/deltorrents.php'; +my $url_sanity = 'http://openbsd.somedomain.net/sanity.php'; my $user = 'torrentup'; my $pass = 'ssapword'; @@ -53,16 +55,18 @@ my %files; opendir DIR, $TorrentDir or die "Couldn't opendir $TorrentDir: $!"; foreach (readdir DIR) { + chomp; if (/^([^\/]+)$/) { $_ = $1; } else { die "Invalid character in $_: $!"; } next unless /\.torrent$/; - chomp; my ($name, $year, $mon, $mday, $hour, $min) = /^(.*)-(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})/; + $mon--; + my $epoch = timegm(0,$min,$hour,$mday,$mon,$year); $files{$name}{$epoch} = { @@ -108,6 +112,7 @@ } } +$ua->get($url_sanity); sub Upload_Torrent { @@ -155,7 +160,7 @@ }, Content_Type => 'form-data'); if ($response->is_success) { - print "Uploaded $file\n"; + print STDERR "Uploaded $file\n"; #print $response->content; } else { die $response->status_line;