Skip to content
Browse files

Output the whitelist for OpenTracker

It's a simple file, but we need to generate it.
  • Loading branch information...
1 parent bc550a7 commit 7350b6cbc40d626e54a5919e6c936775dd1979f8 @afresh1 committed Sep 8, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 CurrentTorrents.pl
View
8 CurrentTorrents.pl
@@ -180,6 +180,10 @@
#print Dump \%keep;
my $json_tmp = $OBT->{DIR_TORRENT} . '/.torrents.json';
my $json_file = $OBT->{DIR_TORRENT} . '/torrents.json';
+my $allowed_tmp = $OBT->{DIR_TORRENT} . '/.allowed.txt';
+my $allowed_file = $OBT->{DIR_TORRENT} . '/allowed.txt';
+open my $allowed_fh, '>', $allowed_tmp
+ or die "Couldn't open $allowed_tmp: $!";
my %current;
foreach my $hash ( keys %keep ) {
@@ -191,6 +195,7 @@
my $reason = $keep{$hash}{reason} ? $keep{$hash}{reason} . q{ } : q{};
$current{$hash} = $keep{$hash}{torrent_data};
+ print $allowed_fh $hash, "\n";
#if ($reason && $reason ne 'only') {
# print "Keeping $reason instance of [$file] [$hash]\n",
@@ -219,7 +224,8 @@
print $fh Mojo::JSON->new->encode( \%current );
close $fh;
-rename $json_tmp, $json_file or die "Couldn't rename $json_file: $!";
+rename $allowed_tmp, $allowed_file or die "Couldn't rename $allowed_file: $!";
+rename $json_tmp, $json_file or die "Couldn't rename $json_file: $!";
foreach (@delete) {
my $path = $_->{dir} . '/' . $_->{file};

0 comments on commit 7350b6c

Please sign in to comment.
Something went wrong with that request. Please try again.