=================================================================== RCS file: /cvs/openbsd/OpenBSDTorrents/MakeTorrents.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- openbsd/OpenBSDTorrents/MakeTorrents.pl 2005/04/07 00:10:06 1.11 +++ openbsd/OpenBSDTorrents/MakeTorrents.pl 2005/05/02 22:49:54 1.12 @@ -1,12 +1,11 @@ #!/usr/bin/perl -T -#$Id: MakeTorrents.pl,v 1.11 2005/04/06 23:10:06 andrew Exp $ +#$Id: MakeTorrents.pl,v 1.12 2005/05/02 21:49:54 andrew Exp $ use strict; use warnings; use diagnostics; -use BT::MetaInfo; - use lib 'lib'; +use BT::OBTMetaInfo; use OpenBSDTorrents; %ENV = (); @@ -30,12 +29,14 @@ { my $basedir = shift; + return undef if $basedir =~ /packages/; + my ($dirs, $files) = Get_Files_and_Dirs($basedir); if (@$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}; foreach my $subdir (@$dirs) { @@ -79,7 +80,7 @@ eval { btmake($torrent, $comment, $files); }; if ($@) { - print "Error creating $torrent\n"; + print "Error creating $torrent\n$@\n"; } # system($BTMake, @@ -107,9 +108,9 @@ my $announce = $OBT->{URL_TRACKER}; 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->announce($announce); unless ($announce =~ m!^http://[^/]+/!i) { @@ -131,8 +132,10 @@ return 0; } - $t->save("$torrent"); - print "Created: $torrent\n"; - #system("btinfo $torrent") if ($::opt_I); + my $hash = $t->info_hash_cached($torrent_with_path); + $hash = unpack("H*", $hash); + + $t->save($torrent_with_path); + print "Created: $torrent_with_path\n"; }