version 1.9, 2005/04/06 23:28:05 |
version 1.10, 2005/04/06 23:40:20 |
|
|
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; |
|
|
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; |
|
|
$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}; |
} |
} |
|
|
|
|
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 $_"; |
} |
} |