diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index c7e3a1597110b913afb7167271232848101fc00c..2a01cc9c57f636026987cb908c85378cb312bbd3 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -153,10 +153,10 @@ class PostProcessor(object): if not file_path: return [] - if file_path != self.file_path: - associated_dir = os.path.dirname(file_path) - associated_fname = os.path.basename(self.file_path) - file_path = os.path.join(associated_dir, associated_fname) +# if file_path != self.file_path: +# associated_dir = os.path.dirname(file_path) +# associated_fname = os.path.basename(self.file_path) +# file_path = os.path.join(associated_dir, associated_fname) file_path_list = [] diff --git a/sickbeard/processTV.py b/sickbeard/processTV.py index 30218db44f08b2e760d2d103b061321dba13086e..99a84df1ae10792b6316d1458145cb6d8f46fbf1 100644 --- a/sickbeard/processTV.py +++ b/sickbeard/processTV.py @@ -76,7 +76,6 @@ def processDir (dirName, nzbName=None, recurse=False): files = ek.ek(os.listdir, dirName) dirs = [dirs] - process_result = False videoFiles = filter(helpers.isMediaFile, files) # If nzbName is set and there's more than one videofile in the folder, files will be lost (overwritten). @@ -110,9 +109,9 @@ def processDir (dirName, nzbName=None, recurse=False): #Process Video File in all TV Subdir for dir in [x for x in dirs if validateDir(path, x, returnStr)]: - -# process_result = False - + + process_result = True + for processPath, processDir, fileList in ek.ek(os.walk, ek.ek(os.path.join, path, dir), topdown=False): videoFiles = filter(helpers.isMediaFile, fileList) @@ -199,5 +198,16 @@ def validateDir(path, dirName, returnStr): if dirName.lower().startswith(ek.ek(os.path.realpath, sqlShow["location"]).lower()+os.sep) or dirName.lower() == ek.ek(os.path.realpath, sqlShow["location"]).lower(): returnStr += logHelper(u"You're trying to post process an episode that's already been moved to its show dir", logger.ERROR) return False + + #check if the dir have at least one tv video file + files = ek.ek(os.listdir, os.path.join(path, dirName)) + videoFiles = filter(helpers.isMediaFile, files) + + for video in videoFiles: + try: + NameParser().parse(video) + return True + except InvalidNameException: + pass - return True + return False