diff --git a/CHANGES.md b/CHANGES.md index 9ca79e83..312e8f49 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -115,6 +115,8 @@ * Change improve handling of relative download links from providers * Change enable TorrentBytes provider * Change after SG is updated, don't attempt to send a Plex client notifications if there is no client host set +* Add file name to possible names in history lookup post processing +* Add garbage name handling to name parser [develop changelog] diff --git a/autoProcessTV/autoProcessTV.py b/autoProcessTV/autoProcessTV.py index adf1e0d8..0ea32186 100755 --- a/autoProcessTV/autoProcessTV.py +++ b/autoProcessTV/autoProcessTV.py @@ -109,6 +109,8 @@ def processEpisode(dir_to_process, org_NZB_name=None, status=None): params = {} + params['is_basedir'] = 0 + params['quiet'] = 1 params['dir'] = dir_to_process diff --git a/sickbeard/auto_post_processer.py b/sickbeard/auto_post_processer.py index e888fb45..e8bc66b9 100644 --- a/sickbeard/auto_post_processer.py +++ b/sickbeard/auto_post_processer.py @@ -43,6 +43,6 @@ class PostProcesser(): '(and probably not what you really want to process)' % sickbeard.TV_DOWNLOAD_DIR, logger.ERROR) return - processTV.processDir(sickbeard.TV_DOWNLOAD_DIR) + processTV.processDir(sickbeard.TV_DOWNLOAD_DIR, is_basedir=True) self.amActive = False diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 303a6e3d..bc9e1027 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -115,6 +115,9 @@ class NameParser(object): if not match: continue + if 'garbage_name' == cur_regex_name: + return + result = ParseResult(new_name) result.which_regex = [cur_regex_name] result.score = 0 - cur_regex_num diff --git a/sickbeard/name_parser/regexes.py b/sickbeard/name_parser/regexes.py index fa048a44..d6420e41 100644 --- a/sickbeard/name_parser/regexes.py +++ b/sickbeard/name_parser/regexes.py @@ -19,6 +19,11 @@ # all regexes are case insensitive normal_regexes = [ + ('garbage_name', + ''' + ^[a-zA-Z0-9]{3,}$ + ''' + ), ('standard_repeat', # Show.Name.S01E02.S01E03.Source.Quality.Etc-Group # Show Name - S01E02 - S01E03 - S01E04 - Ep Name diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index ed0c8db4..9c7b39a2 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -417,7 +417,7 @@ class PostProcessor(object): self.in_history = False # if we don't have either of these then there's nothing to use to search the history for anyway - if not self.nzb_name and not self.folder_name: + if not self.nzb_name and not self.file_name and not self.folder_name: return to_return # make a list of possible names to use in the search @@ -426,6 +426,10 @@ class PostProcessor(object): names.append(self.nzb_name) if '.' in self.nzb_name: names.append(self.nzb_name.rpartition('.')[0]) + if self.file_name: + names.append(self.file_name) + if '.' in self.file_name: + names.append(self.file_name.rpartition('.')[0]) if self.folder_name: names.append(self.folder_name) diff --git a/sickbeard/processTV.py b/sickbeard/processTV.py index bde3adc2..1e15a07f 100644 --- a/sickbeard/processTV.py +++ b/sickbeard/processTV.py @@ -58,12 +58,13 @@ except ImportError: class ProcessTVShow(object): """ Process a TV Show """ - def __init__(self, webhandler=None): + def __init__(self, webhandler=None, is_basedir=True): self.files_passed = 0 self.files_failed = 0 self.fail_detected = False self._output = [] self.webhandler = webhandler + self.is_basedir = is_basedir @property def any_vid_processed(self): @@ -163,8 +164,10 @@ class ProcessTVShow(object): return result - @staticmethod - def check_name(name): + def check_name(self, name): + if self.is_basedir: + return None + so = None my_db = db.DBConnection() sql_results = my_db.select( @@ -189,6 +192,9 @@ class ProcessTVShow(object): return (showObj, alt_showObj)[None is showObj and None is not alt_showObj] def check_video_filenames(self, path, videofiles): + if self.is_basedir: + return None + video_pick = None video_size = 0 for cur_video_file in videofiles: @@ -247,6 +253,9 @@ class ProcessTVShow(object): u'you fill out your completed TV download folder in the PP config.') return self.result + if dir_name == sickbeard.TV_DOWNLOAD_DIR: + self.is_basedir = True + if None is showObj: if isinstance(nzb_name, basestring): showObj = self.check_name(re.sub(r'\.(nzb|torrent)$', '', nzb_name, flags=re.I)) @@ -939,8 +948,8 @@ class ProcessTVShow(object): # backward compatibility prevents the case of this function name from being updated to PEP8 def processDir(dir_name, nzb_name=None, process_method=None, force=False, force_replace=None, - failed=False, type='auto', cleanup=False, webhandler=None, showObj=None): + failed=False, type='auto', cleanup=False, webhandler=None, showObj=None, is_basedir=True): # backward compatibility prevents the case of this function name from being updated to PEP8 - return ProcessTVShow(webhandler).process_dir( + return ProcessTVShow(webhandler, is_basedir).process_dir( dir_name, nzb_name, process_method, force, force_replace, failed, type, cleanup, showObj) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 711ecde9..cbe1b47a 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -2558,7 +2558,7 @@ class HomePostProcess(Home): return t.respond() def processEpisode(self, dir=None, nzbName=None, jobName=None, quiet=None, process_method=None, force=None, - force_replace=None, failed='0', type='auto', stream='0', dupekey=None, **kwargs): + force_replace=None, failed='0', type='auto', stream='0', dupekey=None, is_basedir='1', **kwargs): if not dir and ('0' == failed or not nzbName): self.redirect('/home/postprocess/') @@ -2582,7 +2582,7 @@ class HomePostProcess(Home): force_replace=force_replace in ['on', '1'], failed='0' != failed, webhandler=self.send_message if stream != '0' else None, - showObj=showObj) + showObj=showObj, is_basedir=is_basedir in ['on', '1']) if '0' != stream: return