From e1fa3ea23979c2ddacb2abe8f495fb44a4fc5d2b Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Sat, 28 Sep 2013 21:51:18 +0930 Subject: [PATCH] only scan dir if not Manual Run. fixes #183 --- autoProcess/autoProcessTV.py | 42 ++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/autoProcess/autoProcessTV.py b/autoProcess/autoProcessTV.py index 80080bcb..ba02a3ec 100644 --- a/autoProcess/autoProcessTV.py +++ b/autoProcess/autoProcessTV.py @@ -118,30 +118,26 @@ def processEpisode(dirName, nzbName=None, failed=False): process_all_exceptions(nzbName.lower(), dirName) - # Now check if movie files exist in destination: - video = int(0) - for dirpath, dirnames, filenames in os.walk(dirName): - for file in filenames: - filePath = os.path.join(dirpath, file) - fileExtension = os.path.splitext(file)[1] - if fileExtension in mediaContainer: # If the file is a video file - if is_sample(filePath, nzbName, minSampleSize): - Logger.debug("Removing sample file: %s", filePath) - os.unlink(filePath) # remove samples - else: - video = video + 1 - if video > 0: # Check that a video exists. if not, assume failed. - flatten(dirName) # to make sure SickBeard can find the video (not in sub-folder) - else: - Logger.warning("No media files found in directory %s. Processing this as a failed download", dirName) - status = int(1) - failed = True + if nzbName != "Manual Run": + # Now check if movie files exist in destination: + video = int(0) + for dirpath, dirnames, filenames in os.walk(dirName): + for file in filenames: + filePath = os.path.join(dirpath, file) + fileExtension = os.path.splitext(file)[1] + if fileExtension in mediaContainer: # If the file is a video file + if is_sample(filePath, nzbName, minSampleSize): + Logger.debug("Removing sample file: %s", filePath) + os.unlink(filePath) # remove samples + else: + video = video + 1 + if video > 0: # Check that a video exists. if not, assume failed. + flatten(dirName) # to make sure SickBeard can find the video (not in sub-folder) + else: + Logger.warning("No media files found in directory %s. Processing this as a failed download", dirName) + status = int(1) + failed = True - #allows manual call of postprocess script if we have specified a watch_dir. Check that here. - if nzbName == "Manual Run" and watch_dir == "": - Logger.error("In order to run this script manually you must specify a watch_dir in autoProcessTV.cfg") - return 1 # failure - #allows us to specify the default watch directory and call the postproecssing on another PC with different directory structure. if watch_dir != "": dirName = watch_dir