1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 03:22:22 -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 = {}
itemList = []
searched_scene_season = None
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 epObj.scene_season == 0 or epObj.scene_episode == 0:
logger.log(
@ -257,18 +263,17 @@ class GenericProvider:
# remove duplicate items
itemList = [i for n, i in enumerate(itemList) if i not in itemList[n + 1:]]
searchItems[epObj] = itemList
if epObj.episode in searchItems:
searchItems[epObj] += itemList
else:
searchItems[epObj] = itemList
# mark season searched so we can skip anymore searches of this season if this is a season pack search
searched_scene_season = scene_season
# if we have cached results return them.
if len(results):
return results
for ep_obj, items in searchItems.items():
for item in items:
for ep_obj in searchItems:
for item in searchItems[ep_obj]:
(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):
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()]