Building of name cache executed now at start of searches to prevent building cache for show more then once when not needed

This commit is contained in:
echel0n 2014-09-15 02:46:08 -07:00
parent 47eb4fd21a
commit 627debcf88
2 changed files with 8 additions and 8 deletions

View file

@ -319,11 +319,14 @@ def isFirstBestMatch(result):
return False
def searchForNeededEpisodes(episode):
def searchForNeededEpisodes(show, episode):
foundResults = {}
didSearch = False
# build name cache for show
sickbeard.name_cache.buildNameCache(show)
origThreadName = threading.currentThread().name
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_daily]
@ -396,6 +399,9 @@ def searchProviders(show, episodes, manualSearch=False):
didSearch = False
# build name cache for show
sickbeard.name_cache.buildNameCache(show)
origThreadName = threading.currentThread().name
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_backlog]

View file

@ -93,15 +93,9 @@ class SearchQueue(generic_queue.GenericQueue):
def add_item(self, item):
if isinstance(item, (DailySearchQueueItem, BacklogQueueItem)) and not self.is_in_queue(item.show, item.segment):
# build name cache for show
sickbeard.name_cache.buildNameCache(item.show)
# daily and backlog searches
generic_queue.GenericQueue.add_item(self, item)
elif isinstance(item, (ManualSearchQueueItem, FailedQueueItem)) and not self.is_ep_in_queue(item.segment):
# build name cache for show
sickbeard.name_cache.buildNameCache(item.show)
# manual and failed searches
generic_queue.GenericQueue.add_item(self, item)
else:
@ -118,7 +112,7 @@ class DailySearchQueueItem(generic_queue.QueueItem):
try:
logger.log("Beginning daily search for: [" + self.show.name + "]")
foundResults = search.searchForNeededEpisodes(segment)
foundResults = search.searchForNeededEpisodes(self.show, self.segment)
if not len(foundResults):
logger.log(u"No needed episodes found during daily search for: [" + self.show.name + "]")