Halt postprocessing if temporary btsync files are detected

This commit is contained in:
adam 2014-08-06 21:55:17 +08:00
parent 1908c74e96
commit c4d5e480b5
2 changed files with 23 additions and 0 deletions

View File

@ -136,6 +136,15 @@ def replaceExtension(filename, newExt):
return sepFile[0] + "." + newExt
def isBtsyncFile(filename):
sepFile = filename.rpartition(".")
if sepFile[2].lower() == '!sync':
return True
else:
return False
def isMediaFile(filename):
# ignore samples
if re.search('(^|[\W_])(sample\d*)[\W_]', filename, re.I):

View File

@ -138,6 +138,13 @@ def processDir(dirName, nzbName=None, process_method=None, force=False, is_prior
path, dirs, files = get_path_dir_files(dirName, nzbName, type)
btsyncFiles = filter(helpers.isBtsyncFile, files)
# Don't post process if files are still being synced from btsync
if btsyncFiles:
returnStr += logHelper(u"Found .!sync files, skipping post processing", logger.ERROR)
return returnStr
returnStr += logHelper(u"PostProcessing Path: " + path, logger.DEBUG)
returnStr += logHelper(u"PostProcessing Dirs: " + str(dirs), logger.DEBUG)
@ -179,6 +186,13 @@ def processDir(dirName, nzbName=None, process_method=None, force=False, is_prior
for processPath, processDir, fileList in ek.ek(os.walk, ek.ek(os.path.join, path, dir), topdown=False):
btsyncFiles = filter(helpers.isBtsyncFile, fileList)
# Don't post process if files are still being synced from btsync
if btsyncFiles:
returnStr += logHelper(u"Found .!sync files, skipping post processing", logger.ERROR)
return returnStr
rarFiles = filter(helpers.isRarFile, fileList)
rarContent = unRAR(processPath, rarFiles, force)
fileList = set(fileList + rarContent)