Merge pull request #520 from adam111316/feature/RemoveIndexerQuery

Remove unnecessary call to indexers during nameparsing
This commit is contained in:
adam111316 2015-09-24 20:14:45 +08:00
commit 1e0d7d3595
6 changed files with 9 additions and 19 deletions

View file

@ -42,6 +42,7 @@
* Change remove AlphaRatio until their secure login page over https is fixed
* Add Torrenting provider
* Add FunFile torrent provider
* Remove unnecessary call to indexers during nameparsing
### 0.10.0 (2015-08-06 11:05:00 UTC)

View file

@ -854,7 +854,7 @@ def full_sanitizeSceneName(name):
return re.sub('[. -]', ' ', sanitizeSceneName(name)).lower().lstrip()
def get_show(name, try_indexers=False, try_scene_exceptions=False):
def get_show(name, try_scene_exceptions=False):
if not sickbeard.showList or None is name:
return
@ -872,10 +872,6 @@ def get_show(name, try_indexers=False, try_scene_exceptions=False):
if indexer_id:
show_obj = findCertainShow(sickbeard.showList, indexer_id)
if not show_obj and try_indexers:
show_obj = findCertainShow(sickbeard.showList,
searchIndexerForShowID(full_sanitizeSceneName(name), ui=classes.ShowListUI)[2])
# add show to cache
if show_obj and not from_cache:
sickbeard.name_cache.addNameToCache(name, show_obj.indexerid)

View file

@ -36,12 +36,11 @@ class NameParser(object):
NORMAL_REGEX = 1
ANIME_REGEX = 2
def __init__(self, file_name=True, showObj=None, try_indexers=False, try_scene_exceptions=False, convert=False,
def __init__(self, file_name=True, showObj=None, try_scene_exceptions=False, convert=False,
naming_pattern=False, testing=False):
self.file_name = file_name
self.showObj = showObj
self.try_indexers = try_indexers
self.try_scene_exceptions = try_scene_exceptions
self.convert = convert
self.naming_pattern = naming_pattern
@ -203,7 +202,7 @@ class NameParser(object):
show = None
if not self.naming_pattern:
# try and create a show object for this result
show = helpers.get_show(best_result.series_name, self.try_indexers, self.try_scene_exceptions)
show = helpers.get_show(best_result.series_name, self.try_scene_exceptions)
# confirm passed in show object indexer id matches result show object indexer id
if show and not self.testing:

View file

@ -470,7 +470,7 @@ class PostProcessor(object):
name = helpers.remove_non_release_groups(helpers.remove_extension(name))
# parse the name to break it into show name, season, and episode
np = NameParser(resource, try_indexers=True, try_scene_exceptions=True, convert=True)
np = NameParser(resource, try_scene_exceptions=True, convert=True)
parse_result = np.parse(name)
self._log(u'Parsed %s<br />.. into %s' % (name, str(parse_result).decode('utf-8', 'xmlcharrefreplace')), logger.DEBUG)

View file

@ -421,19 +421,13 @@ class ProcessTVShow(object):
parse_result = None
try:
parse_result = NameParser(try_indexers=True,
try_scene_exceptions=True,
convert=True).parse(videofile,
cache_result=False)
parse_result = NameParser(try_scene_exceptions=True, convert=True).parse(videofile, cache_result=False)
except (InvalidNameException, InvalidShowException):
# Does not parse, move on to directory check
pass
if None is parse_result:
try:
parse_result = NameParser(try_indexers=True,
try_scene_exceptions=True,
convert=True).parse(
dir_name, cache_result=False)
parse_result = NameParser(try_scene_exceptions=True,convert=True).parse(dir_name, cache_result=False)
except (InvalidNameException, InvalidShowException):
# If the filename doesn't parse, then return false as last
# resort. We can assume that unparseable filenames are not

View file

@ -427,7 +427,7 @@ class TVShow(object):
try:
parse_result = None
np = NameParser(False, showObj=self, try_indexers=True)
np = NameParser(False, showObj=self)
parse_result = np.parse(ep_file_name)
except (InvalidNameException, InvalidShowException):
pass
@ -619,7 +619,7 @@ class TVShow(object):
logger.log(u'%s: Creating episode object from %s' % (self.indexerid, file), logger.DEBUG)
try:
my_parser = NameParser(showObj=self, try_indexers=True)
my_parser = NameParser(showObj=self)
parse_result = my_parser.parse(file)
except InvalidNameException:
logger.log(u'Unable to parse the filename %s into a valid episode' % file, logger.DEBUG)