mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Halt postprocessing if temporary btsync files are detected
This commit is contained in:
parent
1908c74e96
commit
c4d5e480b5
2 changed files with 23 additions and 0 deletions
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue