only scan dir if not Manual Run. fixes #183

This commit is contained in:
Clinton Hall 2013-09-28 21:51:18 +09:30
commit e1fa3ea239

View file

@ -118,30 +118,26 @@ def processEpisode(dirName, nzbName=None, failed=False):
process_all_exceptions(nzbName.lower(), dirName) process_all_exceptions(nzbName.lower(), dirName)
# Now check if movie files exist in destination: if nzbName != "Manual Run":
video = int(0) # Now check if movie files exist in destination:
for dirpath, dirnames, filenames in os.walk(dirName): video = int(0)
for file in filenames: for dirpath, dirnames, filenames in os.walk(dirName):
filePath = os.path.join(dirpath, file) for file in filenames:
fileExtension = os.path.splitext(file)[1] filePath = os.path.join(dirpath, file)
if fileExtension in mediaContainer: # If the file is a video file fileExtension = os.path.splitext(file)[1]
if is_sample(filePath, nzbName, minSampleSize): if fileExtension in mediaContainer: # If the file is a video file
Logger.debug("Removing sample file: %s", filePath) if is_sample(filePath, nzbName, minSampleSize):
os.unlink(filePath) # remove samples Logger.debug("Removing sample file: %s", filePath)
else: os.unlink(filePath) # remove samples
video = video + 1 else:
if video > 0: # Check that a video exists. if not, assume failed. video = video + 1
flatten(dirName) # to make sure SickBeard can find the video (not in sub-folder) if video > 0: # Check that a video exists. if not, assume failed.
else: flatten(dirName) # to make sure SickBeard can find the video (not in sub-folder)
Logger.warning("No media files found in directory %s. Processing this as a failed download", dirName) else:
status = int(1) Logger.warning("No media files found in directory %s. Processing this as a failed download", dirName)
failed = True 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 != "": if watch_dir != "":
dirName = watch_dir dirName = watch_dir