=================================================================== RCS file: /cvs/openbsd/OpenBSDTorrents/ServerTorrents.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- openbsd/OpenBSDTorrents/ServerTorrents.pl 2005/04/04 03:14:17 1.9 +++ openbsd/OpenBSDTorrents/ServerTorrents.pl 2005/04/07 00:05:28 1.10 @@ -1,5 +1,5 @@ #!/usr/bin/perl -T -#$Id: ServerTorrents.pl,v 1.9 2005/04/04 02:14:17 andrew Exp $ +#$Id: ServerTorrents.pl,v 1.10 2005/04/06 23:05:28 andrew Exp $ use strict; use warnings; use diagnostics; @@ -17,18 +17,10 @@ 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'; - my @Sizes = ('', 'Ki', 'Mi', 'Gi', 'Ti'); my $ua = LWP::UserAgent->new; -my $response = $ua->get($url_torrents); +my $response = $ua->get($OBT->{URL_TORRENTS}); my %server_torrents; if ($response->is_success) { @@ -53,7 +45,7 @@ my %files; -opendir DIR, $TorrentDir or die "Couldn't opendir $TorrentDir: $!"; +opendir DIR, $OBT->{DIR_TORRENT} or die "Couldn't opendir $OBT->{DIR_TORRENT}: $!"; foreach (readdir DIR) { chomp; if (/^([^\/]+)$/) { @@ -115,7 +107,7 @@ } } -$ua->get($url_sanity); +$ua->get($OBT->{URL_SANITY}); sub Upload_Torrent { @@ -125,7 +117,7 @@ print "Uploading $file\n"; my $t; - eval { $t = BT::MetaInfo->new("$TorrentDir/$file"); }; + eval { $t = BT::MetaInfo->new("$OBT->{DIR_TORRENT}/$file"); }; if ($@) { warn "Error reading torrent $file\n"; return undef; @@ -150,10 +142,10 @@ $comment .= " [$size]"; $filename .= " [$time]"; - my $response = $ua->post($url_upload, { - username => $user, - password => $pass, - torrent => [ "$TorrentDir/$file" ], + my $response = $ua->post($OBT->{URL_UPLOAD}, { + username => $OBT->{UPLOAD_USER}, + password => $OBT->{UPLOAD_PASS}, + torrent => [ $OBT->{DIR_TORRENT} . "/$file" ], url => "/torrents/$file", filename => $filename, filedate => $time,