diff --git a/CHANGES.md b/CHANGES.md index 87857224..730641e0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -74,6 +74,7 @@ * Change improve clarity of various error message by including relevant show name * Change extend WEB PROPER release group check to ignore SD releases * Change increase performance by reducing TVDb API requests with a global token +* Change make indexer lookup optional in NameParser, and deactivate during searches [develop changelog] diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 241288e8..cd85a9a7 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -36,7 +36,7 @@ class NameParser(object): ANIME_REGEX = 2 def __init__(self, file_name=True, showObj=None, try_scene_exceptions=False, convert=False, - naming_pattern=False, testing=False): + naming_pattern=False, testing=False, indexer_lookup=True): self.file_name = file_name self.showObj = showObj @@ -44,6 +44,7 @@ class NameParser(object): self.convert = convert self.naming_pattern = naming_pattern self.testing = testing + self.indexer_lookup = indexer_lookup if self.showObj and not self.showObj.is_anime: self._compile_regexes(self.NORMAL_REGEX) @@ -263,7 +264,7 @@ class NameParser(object): season_number = int(sql_result[0][0]) episode_numbers = [int(sql_result[0][1])] - if not season_number or not len(episode_numbers): + if self.indexer_lookup and not season_number or not len(episode_numbers): try: lindexer_api_parms = sickbeard.indexerApi(show.indexer).api_params.copy() diff --git a/sickbeard/properFinder.py b/sickbeard/properFinder.py index a09729e8..795993ac 100644 --- a/sickbeard/properFinder.py +++ b/sickbeard/properFinder.py @@ -76,7 +76,7 @@ def _get_proper_list(aired_since_shows, recent_shows, recent_anime): # for each provider get a list of the orig_thread_name = threading.currentThread().name providers = [x for x in sickbeard.providers.sortedProviderList() if x.is_active()] - np = NameParser(False, try_scene_exceptions=True) + np = NameParser(False, try_scene_exceptions=True, indexer_lookup=False) for cur_provider in providers: if not recent_anime and cur_provider.anime_only: continue @@ -103,7 +103,7 @@ def _get_proper_list(aired_since_shows, recent_shows, recent_anime): name = _generic_name(x.name) if name not in propers: try: - np = NameParser(False, try_scene_exceptions=True, showObj=x.parsed_show) + np = NameParser(False, try_scene_exceptions=True, showObj=x.parsed_show, indexer_lookup=False) parse_result = np.parse(x.name) if parse_result.series_name and parse_result.episode_numbers and \ parse_result.show.indexerid in recent_shows + recent_anime: @@ -147,7 +147,7 @@ def _get_proper_list(aired_since_shows, recent_shows, recent_anime): logger.DEBUG) continue - if not show_name_helpers.pass_wordlist_checks(cur_proper.name, parse=False): + if not show_name_helpers.pass_wordlist_checks(cur_proper.name, parse=False, indexer_lookup=False): logger.log(u'Proper %s isn\'t a valid scene release that we want, ignoring it' % cur_proper.name, logger.DEBUG) continue diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 73012f4e..801fc2cc 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -484,7 +484,7 @@ class GenericProvider: for item in item_list: (title, url) = self._title_and_url(item) - parser = NameParser(False, showObj=self.get_show(item, **kwargs), convert=True) + parser = NameParser(False, showObj=self.get_show(item, **kwargs), convert=True, indexer_lookup=False) # parse the file name try: parse_result = parser.parse(title) diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index 179dd353..e2070579 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -95,7 +95,7 @@ class ThePirateBayProvider(generic.TorrentProvider): return None try: - my_parser = NameParser(showObj=self.show) + my_parser = NameParser(showObj=self.show, indexer_lookup=False) parse_result = my_parser.parse(file_name) except (InvalidNameException, InvalidShowException): return None diff --git a/sickbeard/search.py b/sickbeard/search.py index 6186ba82..21b60af6 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -543,7 +543,8 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr # skip non-tv crap search_results[cur_ep] = filter( lambda ep_item: show_name_helpers.pass_wordlist_checks( - ep_item.name, parse=False) and ep_item.show == show, search_results[cur_ep]) + ep_item.name, parse=False, indexer_lookup=False) and + ep_item.show == show, search_results[cur_ep]) if cur_ep in found_results: found_results[provider_id][cur_ep] += search_results[cur_ep] @@ -626,7 +627,7 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr individual_results = filter( lambda r: show_name_helpers.pass_wordlist_checks( - r.name, parse=False) and r.show == show, individual_results) + r.name, parse=False, indexer_lookup=False) and r.show == show, individual_results) for cur_result in individual_results: if 1 == len(cur_result.episodes): @@ -772,7 +773,7 @@ def search_providers(show, episodes, manual_search=False, torrent_only=False, tr if name: if not pass_show_wordlist_checks(name, show): continue - if not show_name_helpers.pass_wordlist_checks(name): + if not show_name_helpers.pass_wordlist_checks(name, indexer_lookup=False): logger.log('Ignored: %s (debug log has detail)' % name) continue best_result.name = name diff --git a/sickbeard/show_name_helpers.py b/sickbeard/show_name_helpers.py index a354b856..aa6568f1 100644 --- a/sickbeard/show_name_helpers.py +++ b/sickbeard/show_name_helpers.py @@ -31,7 +31,7 @@ from sickbeard import encodingKludge as ek from name_parser.parser import NameParser, InvalidNameException, InvalidShowException -def pass_wordlist_checks(name, parse=True): +def pass_wordlist_checks(name, parse=True, indexer_lookup=True): """ Filters out non-english and just all-around stupid releases by comparing the word list contents at boundaries or the end of name. @@ -44,7 +44,7 @@ def pass_wordlist_checks(name, parse=True): if parse: err_msg = u'Unable to parse the filename %s into a valid ' % name try: - NameParser().parse(name) + NameParser(indexer_lookup=indexer_lookup).parse(name) except InvalidNameException: logger.log(err_msg + 'episode', logger.DEBUG) return False diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index f464450d..d4e86ff9 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -208,7 +208,7 @@ class TVCache: return None try: - np = NameParser(showObj=showObj, convert=True) + np = NameParser(showObj=showObj, convert=True, indexer_lookup=False) parse_result = np.parse(name) except InvalidNameException: logger.log(u'Unable to parse the filename ' + name + ' into a valid episode', logger.DEBUG) @@ -292,7 +292,7 @@ class TVCache: for curResult in sqlResults: # skip non-tv crap - if not show_name_helpers.pass_wordlist_checks(curResult['name'], parse=False): + if not show_name_helpers.pass_wordlist_checks(curResult['name'], parse=False, indexer_lookup=False): continue # get the show object, or if it's not one of our shows then ignore it