1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 06:45:05 -05:00

Fixed more unrequired search strings from being created and wasting our time doing duplicate searches

This commit is contained in:
echel0n 2014-05-15 22:40:49 -07:00
parent 4576ade4ce
commit e309aa2cbf
2 changed files with 15 additions and 7 deletions

View File

@ -232,7 +232,13 @@ class GenericProvider:
searchItems = {} searchItems = {}
itemList = [] itemList = []
searched_scene_season = None
for epObj in episodes: for epObj in episodes:
scene_season = epObj.scene_season
if seasonSearch and searched_scene_season:
if scene_season == searched_scene_season:
continue
if not epObj.show.air_by_date: if not epObj.show.air_by_date:
if epObj.scene_season == 0 or epObj.scene_episode == 0: if epObj.scene_season == 0 or epObj.scene_episode == 0:
logger.log( logger.log(
@ -257,18 +263,17 @@ class GenericProvider:
# remove duplicate items # remove duplicate items
itemList = [i for n, i in enumerate(itemList) if i not in itemList[n + 1:]] itemList = [i for n, i in enumerate(itemList) if i not in itemList[n + 1:]]
searchItems[epObj] = itemList
if epObj.episode in searchItems: # mark season searched so we can skip anymore searches of this season if this is a season pack search
searchItems[epObj] += itemList searched_scene_season = scene_season
else:
searchItems[epObj] = itemList
# if we have cached results return them. # if we have cached results return them.
if len(results): if len(results):
return results return results
for ep_obj, items in searchItems.items(): for ep_obj in searchItems:
for item in items: for item in searchItems[ep_obj]:
(title, url) = self._get_title_and_url(item) (title, url) = self._get_title_and_url(item)

View File

@ -317,7 +317,10 @@ def filterSearchResults(show, results):
def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manualSearch=False): def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manualSearch=False):
logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season)) if seasonSearch:
logger.log(u"Searching for " + show.name + " season " + str(season) + " pack")
else:
logger.log(u"Searching for episodes we need from " + show.name + " season " + str(season))
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()] providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]