=================================================================== RCS file: /cvs/openbsd/OpenBSDTorrents/MakeTorrents.pl,v retrieving revision 1.5 retrieving revision 1.8 diff -u -r1.5 -r1.8 --- openbsd/OpenBSDTorrents/MakeTorrents.pl 2005/03/23 00:08:18 1.5 +++ openbsd/OpenBSDTorrents/MakeTorrents.pl 2005/03/24 19:49:09 1.8 @@ -1,5 +1,5 @@ #!/usr/bin/perl -T -#$Id: MakeTorrents.pl,v 1.5 2005/03/23 00:08:18 andrew Exp $ +#$Id: MakeTorrents.pl,v 1.8 2005/03/24 19:49:09 andrew Exp $ use strict; use warnings; use diagnostics; @@ -13,9 +13,10 @@ use YAML; -my $BTMake = '/usr/local/bin/btmake'; my $Piece_Length = 18; + my $MinFiles = 5; +my $MinSize = 50 * 1024 * 1024; # 50 MiB my $StartDir = shift || $BaseName; $StartDir =~ s#/$##; @@ -75,7 +76,10 @@ "Created by andrew fresh (andrew\@mad-techies.org)\n" . "http://OpenBSD.somedomain.net/"; - btmake($torrent, $comment, $files); + eval { btmake($torrent, $comment, $files); }; + if ($@) { + print "Error creating $torrent\n"; + } # system($BTMake, # '-C', @@ -120,6 +124,12 @@ $t->creation_date(time); warn "Checksumming files. This may take a little while...\n"; $t->set_files(@$files); + + if ($t->total_size < $MinSize) { + print "Skipping smaller than minimum size\n"; + return 0; + } + $t->save("$torrent"); print "Created: $torrent\n"; #system("btinfo $torrent") if ($::opt_I);