[BACK]Return to CurrentTorrents.pl CVS log [TXT][DIR] Up to [local] / openbsd / OpenBSDTorrents

Diff for /openbsd/OpenBSDTorrents/CurrentTorrents.pl between version 1.7 and 1.10

version 1.7, 2005/03/28 22:52:01 version 1.10, 2005/04/06 23:40:20
Line 7 
Line 7 
 use BT::MetaInfo;  use BT::MetaInfo;
 use Time::Local;  use Time::Local;
   
 use lib '/usr/local/bin/OpenBSDTorrents/lib';  use lib 'lib';
 use OpenBSDTorrents;  use OpenBSDTorrents;
   
 %ENV = ();  %ENV = ();
Line 17 
Line 17 
 justme();  justme();
   
 my %files;  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) {  foreach (readdir DIR) {
         if (/^([^\/]+)$/) {          if (/^([^\/]+)$/) {
                 $_ = $1;                  $_ = $1;
Line 28 
Line 29 
         my ($name, $year, $mon, $mday, $hour, $min) =          my ($name, $year, $mon, $mday, $hour, $min) =
            /^(.*)-(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})/;             /^(.*)-(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})/;
   
           $mon--;
         my $epoch = timegm(0,$min,$hour,$mday,$mon,$year);          my $epoch = timegm(0,$min,$hour,$mday,$mon,$year);
   
         #print "Adding $_\n";          #print "Adding $_\n";
Line 55 
Line 57 
                 my $torrent = $files{$name}{$epoch}{file};                  my $torrent = $files{$name}{$epoch}{file};
   
                 my $t;                  my $t;
                 eval { $t = BT::MetaInfo->new("$TorrentDir/$torrent"); };                  eval { $t = BT::MetaInfo->new($OBT->{DIR_TORRENT} . "/$torrent"); };
                 if ($@) {                  if ($@) {
                         warn "Error reading torrent $torrent\n";                          warn "Error reading torrent $torrent\n";
                         next;                          next;
Line 64 
Line 66 
                 $files{$name}{$epoch}{comment}   = $t->{comment};                  $files{$name}{$epoch}{comment}   = $t->{comment};
                 my ($path) = $t->{comment} =~ /Files from ([^\n]+)\n/s;                  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";                          #print "Deleting $files{$name}{$epoch}{file} the path doesn't exist.\n";
                         push @delete, $files{$name}{$epoch}{file};                          push @delete, $files{$name}{$epoch}{file};
                 }                  }
Line 101 
Line 103 
   
 foreach (@delete) {  foreach (@delete) {
         print "Deleting '$_'\n";          print "Deleting '$_'\n";
         unlink "$TorrentDir/$_" or die "Couldn't unlink $_";          unlink $OBT->{TORRENTDIR} . "/$_" or die "Couldn't unlink $_";
 }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>