ソースを参照

Allow forced deletes

Zachary Kotlarek 9 年 前
親
コミット
9ff530346f
1 ファイル変更、8 行追加、3 行削除
  1. 8 3
      transmission.pl

+ 8 - 3
transmission.pl

@@ -63,6 +63,11 @@ if ($ENV{'DEBUG'}) {
 		$DEBUG = 1;
 	}
 }
+my $DELETE = 0;
+if ($ENV{'DELETE'}) {
+	print STDERR "Failure mode: DELETE\n";
+	$DELETE = 1;
+}
 
 # Command-line parameters
 my ($hash) = @ARGV;
@@ -129,7 +134,7 @@ if (available($CONFIG{'TRANS_URL'})) {
 		if ($DEBUG) {
 			print STDERR 'Processing completed torrent: ' . $tor->{'name'} . "\n";
 		}
-		if (storeTor($tor)) {
+		if (storeTor($tor) || $DELETE) {
 			delTor($tor);
 		} else {
 			print STDERR 'Unable to store torrent: ' . $tor->{'name'} . "\n";
@@ -175,8 +180,8 @@ if (available($CONFIG{'TRANS_URL'})) {
 			}
 
 			# Process sucessful NZBs
-			if ($nzb->{'status'} eq 'SUCCESS/UNPACK') {
-				if (storeNZB($nzb)) {
+			if ($nzb->{'status'} =~ /SUCCESS\/(?:UNPACK|HEALTH)/) {
+				if (storeNZB($nzb) || $DELETE) {
 					delNZB($nzb);
 				} else {
 					print STDERR 'Unable to store NZB: ' . $nzb->{'name'} . "\n";