| version 1.25, 2008/11/14 18:18:31 |
version 1.26, 2009/10/20 20:04:28 |
|
|
| #!/usr/bin/perl -T |
#!/usr/bin/perl -T |
| #$RedRiver: CurrentTorrents.pl,v 1.24 2007/11/02 02:36:01 andrew Exp $ |
#$RedRiver: CurrentTorrents.pl,v 1.25 2008/11/14 18:18:31 andrew Exp $ |
| use strict; |
use strict; |
| use warnings; |
use warnings; |
| use diagnostics; |
use diagnostics; |
|
|
| } |
} |
| |
|
| #print Dump \%files; |
#print Dump \%files; |
| foreach my $name (keys %{ $files{torrent} }) { |
foreach my $name (sort keys %{ $files{torrent} }) { |
| next unless $name =~ /^$Name_Filter/; |
next unless $name =~ /^$Name_Filter/; |
| #print "Checking $name\n"; |
#print "Checking $name\n"; |
| |
|
|
|
| $files{torrent}{$name}{$epoch}{dir} |
$files{torrent}{$name}{$epoch}{dir} |
| eq $OBT->{DIR_TORRENT} |
eq $OBT->{DIR_TORRENT} |
| ) { |
) { |
| print "Skipping torrent for $name there is only one.\n"; |
#print "Skipping torrent for $name there is only one.\n"; |
| next; |
next; |
| } |
} |
| |
|
|
|
| $keep{$name}{$hash}{path}, |
$keep{$name}{$hash}{path}, |
| "\n"; |
"\n"; |
| } else { |
} else { |
| print "Removing old [$name] [$hash]\n\t", |
print "Removing old [$name] [$hash]\n"; |
| $keep{$name}{$hash}{path}, |
if ( $keep{$name}{$hash}{path} ) { |
| "\n"; |
print "\t", $keep{$name}{$hash}{path}, |
| |
"\n"; |
| |
} |
| push @delete, $files{torrent}{$name}{$epoch}; |
push @delete, $files{torrent}{$name}{$epoch}; |
| delete $files{torrent}{$name}{$epoch}; |
delete $files{torrent}{$name}{$epoch}; |
| } |
} |
|
|
| #print Dump \%keep; |
#print Dump \%keep; |
| foreach my $name (keys %keep) { |
foreach my $name (keys %keep) { |
| foreach my $hash (keys %{ $keep{$name} }) { |
foreach my $hash (keys %{ $keep{$name} }) { |
| my $file = $keep{$name}{$hash}{file}; |
my $file = $keep{$name}{$hash}{file} || q{}; |
| my $dir = $keep{$name}{$hash}{dir }; |
my $dir = $keep{$name}{$hash}{dir } || q{}; |
| if ($dir eq $OBT->{DIR_NEW_TORRENT}) { |
if ($dir eq $OBT->{DIR_NEW_TORRENT}) { |
| print "Moving $file to current torrents\n"; |
print "Moving $file to current torrents\n"; |
| rename("$dir/$file", $OBT->{DIR_TORRENT} . "/" . $file) |
rename("$dir/$file", $OBT->{DIR_TORRENT} . "/" . $file) |