version 1.13, 2005/05/03 05:33:15 |
version 1.17, 2005/05/20 01:18:24 |
|
|
use diagnostics; |
use diagnostics; |
|
|
use lib 'lib'; |
use lib 'lib'; |
use BT::OBTMetaInfo; |
use BT::MetaInfo::Cached; |
use OpenBSDTorrents; |
use OpenBSDTorrents; |
|
|
%ENV = (); |
%ENV = (); |
|
|
|
|
my $torrent_with_path = $OBT->{DIR_NEW_TORRENT} . "/$torrent"; |
my $torrent_with_path = $OBT->{DIR_NEW_TORRENT} . "/$torrent"; |
|
|
my $t = BT::OBTMetaInfo->new(); |
my $t = BT::MetaInfo::Cached->new( |
|
{ |
|
cache_root => |
|
$OBT->{DIR_HOME} . '/FileCache' |
|
} |
|
); |
|
|
$t->name($name); |
$t->name($name); |
$t->announce($announce); |
$t->announce($announce); |
unless ($announce =~ m!^http://[^/]+/!i) { |
unless ($announce =~ m!^http://[^/]+/!i) { |
|
|
# } |
# } |
#} |
#} |
$t->piece_length($piece_len); |
$t->piece_length($piece_len); |
$t->creation_date(time); |
$t->creation_date(gmtime); |
print "Checksumming files. This may take a little while...\n"; |
print "Checksumming files. This may take a little while...\n"; |
$t->set_files(@$files); |
$t->set_files(@$files); |
|
|
|
|
return 0; |
return 0; |
} |
} |
|
|
my $hash = $t->info_hash_cached($torrent_with_path); |
my $hash = $t->info_hash; |
$hash = unpack("H*", $hash); |
$hash = unpack("H*", $hash); |
|
|
$t->save($torrent_with_path); |
$t->save($torrent_with_path); |