From 47a1dcb9577a527f88bf7256a56bf93017408946 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sun, 15 Jun 2014 20:52:21 +0930 Subject: [PATCH] better nzbdrone status check. Fixes #433 --- nzbtomedia/autoProcess/autoProcessTV.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nzbtomedia/autoProcess/autoProcessTV.py b/nzbtomedia/autoProcess/autoProcessTV.py index 8f157280..28a94e56 100644 --- a/nzbtomedia/autoProcess/autoProcessTV.py +++ b/nzbtomedia/autoProcess/autoProcessTV.py @@ -232,9 +232,12 @@ class autoProcessTV: return 0 elif section == "NzbDrone" and Started: n = 0 + exists = True current_numMissing = start_numMissing while n < 6: # set up wait_for minutes of no change in numMissing. time.sleep(10 * wait_for) + if not os.path.exists(dirName): + break new_numMissing = self.numMissing(url1, params, headers) if new_numMissing == current_numMissing: # nothing processed since last call n += 1 @@ -242,7 +245,10 @@ class autoProcessTV: n = 0 current_numMissing = new_numMissing # reset counter and start loop again with this many missing. - if current_numMissing < start_numMissing: + if not os.path.exists(dirName): + logger.debug("The directory %s has been removed. Renaming was successful." % (dirName), section) + return 0 + elif current_numMissing < start_numMissing: logger.debug( "The number of missing episodes changes from %s to %s and then remained the same for %s minutes. Consider this successful" % (str(start_numMissing), str(current_numMissing), str(wait_for)), section)