=================================================================== RCS file: /cvs/openbsd/OpenBSDTorrents/CurrentTorrents.pl,v retrieving revision 1.7 retrieving revision 1.10 diff -u -r1.7 -r1.10 --- openbsd/OpenBSDTorrents/CurrentTorrents.pl 2005/03/28 22:52:01 1.7 +++ openbsd/OpenBSDTorrents/CurrentTorrents.pl 2005/04/06 23:40:20 1.10 @@ -1,5 +1,5 @@ #!/usr/bin/perl -T -#$Id: CurrentTorrents.pl,v 1.7 2005/03/28 22:52:01 andrew Exp $ +#$Id: CurrentTorrents.pl,v 1.10 2005/04/06 22:40:20 andrew Exp $ use strict; use warnings; use diagnostics; @@ -7,7 +7,7 @@ use BT::MetaInfo; use Time::Local; -use lib '/usr/local/bin/OpenBSDTorrents/lib'; +use lib 'lib'; use OpenBSDTorrents; %ENV = (); @@ -17,7 +17,8 @@ justme(); 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) { if (/^([^\/]+)$/) { $_ = $1; @@ -28,6 +29,7 @@ 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); #print "Adding $_\n"; @@ -55,7 +57,7 @@ my $torrent = $files{$name}{$epoch}{file}; my $t; - eval { $t = BT::MetaInfo->new("$TorrentDir/$torrent"); }; + eval { $t = BT::MetaInfo->new($OBT->{DIR_TORRENT} . "/$torrent"); }; if ($@) { warn "Error reading torrent $torrent\n"; next; @@ -64,7 +66,7 @@ $files{$name}{$epoch}{comment} = $t->{comment}; my ($path) = $t->{comment} =~ /Files from ([^\n]+)\n/s; - unless (-d "$BaseDir/$path") { + unless (-d $OBT->{DIR_FTP} . "/$path") { #print "Deleting $files{$name}{$epoch}{file} the path doesn't exist.\n"; push @delete, $files{$name}{$epoch}{file}; } @@ -101,5 +103,5 @@ foreach (@delete) { print "Deleting '$_'\n"; - unlink "$TorrentDir/$_" or die "Couldn't unlink $_"; + unlink $OBT->{TORRENTDIR} . "/$_" or die "Couldn't unlink $_"; }