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

Diff for /openbsd/OpenBSDTorrents/MakeTorrents.pl between version 1.11 and 1.12

version 1.11, 2005/04/07 00:10:06 version 1.12, 2005/05/02 22:49:54
Line 4 
Line 4 
 use warnings;  use warnings;
 use diagnostics;  use diagnostics;
   
 use BT::MetaInfo;  
   
 use lib 'lib';  use lib 'lib';
   use BT::OBTMetaInfo;
 use OpenBSDTorrents;  use OpenBSDTorrents;
   
 %ENV = ();  %ENV = ();
Line 30 
Line 29 
 {  {
         my $basedir = shift;          my $basedir = shift;
   
           return undef if $basedir =~ /packages/;
   
         my ($dirs, $files) = Get_Files_and_Dirs($basedir);          my ($dirs, $files) = Get_Files_and_Dirs($basedir);
         if (@$files) {          if (@$files) {
                 my $torrent = Make_Torrent($basedir, $files);                  my $torrent = Make_Torrent($basedir, $files);
         }          }
   
         # don't recurse if we were called on a specific directory          # don't recurse if we were started with a specific directory
         return 1 if $StartDir ne $OBT->{BASENAME};          return 1 if $StartDir ne $OBT->{BASENAME};
   
         foreach my $subdir (@$dirs) {          foreach my $subdir (@$dirs) {
Line 79 
Line 80 
   
         eval { btmake($torrent, $comment, $files); };          eval { btmake($torrent, $comment, $files); };
         if ($@) {          if ($@) {
                 print "Error creating $torrent\n";                  print "Error creating $torrent\n$@\n";
         }          }
   
 #        system($BTMake,  #        system($BTMake,
Line 107 
Line 108 
     my $announce = $OBT->{URL_TRACKER};      my $announce = $OBT->{URL_TRACKER};
     my $piece_len = 2 << ($OBT->{PIECE_LENGTH} - 1);      my $piece_len = 2 << ($OBT->{PIECE_LENGTH} - 1);
   
     $torrent = $OBT->{DIR_TORRENT} . "/$torrent";      my $torrent_with_path = $OBT->{DIR_NEW_TORRENT} . "/$torrent";
   
     my $t = BT::MetaInfo->new();      my $t = BT::OBTMetaInfo->new();
     $t->name($name);      $t->name($name);
     $t->announce($announce);      $t->announce($announce);
     unless ($announce =~ m!^http://[^/]+/!i) {      unless ($announce =~ m!^http://[^/]+/!i) {
Line 131 
Line 132 
         return 0;          return 0;
     }      }
   
     $t->save("$torrent");      my $hash = $t->info_hash_cached($torrent_with_path);
     print "Created: $torrent\n";      $hash = unpack("H*", $hash);
     #system("btinfo $torrent") if ($::opt_I);  
       $t->save($torrent_with_path);
       print "Created: $torrent_with_path\n";
 }  }
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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