From 8188455e13e8f833e6a7cebac59afcf7e29f45b4 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Tue, 29 Apr 2014 12:02:50 +0930 Subject: [PATCH] only report success and clean if we get a success comment from SickBeard. fixes #348 #351 --- nzbtomedia/autoProcess/autoProcessTV.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nzbtomedia/autoProcess/autoProcessTV.py b/nzbtomedia/autoProcess/autoProcessTV.py index d9f12d6f..53fd5b6e 100644 --- a/nzbtomedia/autoProcess/autoProcessTV.py +++ b/nzbtomedia/autoProcess/autoProcessTV.py @@ -147,11 +147,18 @@ class autoProcessTV: logger.error("Unable to open URL: %s" % (url), section) return 1 # failure + Success = False for line in r.iter_lines(): - if line: logger.postprocess("%s" % (line), section) + if line: + logger.postprocess("%s" % (line), section) + if "Processing succeeded for" in line: # We set Success based on the last non-empty line in the output. + Success = True if status != 0 and delete_failed and not os.path.dirname(dirName) == dirName: logger.postprocess("Deleting failed files and folder %s" % (dirName),section) rmDir(dirName) - return 0 # Success + if Success: + return 0 + else: + return 1