mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 11:58:01 -05:00
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:
parent
47eb4fd21a
commit
627debcf88
@ -319,11 +319,14 @@ def isFirstBestMatch(result):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def searchForNeededEpisodes(episode):
|
def searchForNeededEpisodes(show, episode):
|
||||||
foundResults = {}
|
foundResults = {}
|
||||||
|
|
||||||
didSearch = False
|
didSearch = False
|
||||||
|
|
||||||
|
# build name cache for show
|
||||||
|
sickbeard.name_cache.buildNameCache(show)
|
||||||
|
|
||||||
origThreadName = threading.currentThread().name
|
origThreadName = threading.currentThread().name
|
||||||
|
|
||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_daily]
|
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
|
didSearch = False
|
||||||
|
|
||||||
|
# build name cache for show
|
||||||
|
sickbeard.name_cache.buildNameCache(show)
|
||||||
|
|
||||||
origThreadName = threading.currentThread().name
|
origThreadName = threading.currentThread().name
|
||||||
|
|
||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_backlog]
|
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_backlog]
|
||||||
|
@ -93,15 +93,9 @@ class SearchQueue(generic_queue.GenericQueue):
|
|||||||
|
|
||||||
def add_item(self, item):
|
def add_item(self, item):
|
||||||
if isinstance(item, (DailySearchQueueItem, BacklogQueueItem)) and not self.is_in_queue(item.show, item.segment):
|
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
|
# daily and backlog searches
|
||||||
generic_queue.GenericQueue.add_item(self, item)
|
generic_queue.GenericQueue.add_item(self, item)
|
||||||
elif isinstance(item, (ManualSearchQueueItem, FailedQueueItem)) and not self.is_ep_in_queue(item.segment):
|
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
|
# manual and failed searches
|
||||||
generic_queue.GenericQueue.add_item(self, item)
|
generic_queue.GenericQueue.add_item(self, item)
|
||||||
else:
|
else:
|
||||||
@ -118,7 +112,7 @@ class DailySearchQueueItem(generic_queue.QueueItem):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
logger.log("Beginning daily search for: [" + self.show.name + "]")
|
logger.log("Beginning daily search for: [" + self.show.name + "]")
|
||||||
foundResults = search.searchForNeededEpisodes(segment)
|
foundResults = search.searchForNeededEpisodes(self.show, self.segment)
|
||||||
|
|
||||||
if not len(foundResults):
|
if not len(foundResults):
|
||||||
logger.log(u"No needed episodes found during daily search for: [" + self.show.name + "]")
|
logger.log(u"No needed episodes found during daily search for: [" + self.show.name + "]")
|
||||||
|
Loading…
Reference in New Issue
Block a user