diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 7fe79f6c..76b3b81f 100644 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -35,8 +35,8 @@ __all__ = ['ezrss', ] import sickbeard +import generic from sickbeard import logger - from os import sys diff --git a/sickbeard/search.py b/sickbeard/search.py index 53a01cc5..14219c04 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -383,32 +383,18 @@ def searchProviders(show, season, episode=None, manualSearch=False): curResults.update(results) # did we find our results ? - if curResults: - logger.log(u"Cache results: " + str(curResults), logger.DEBUG) + if len(curResults): + logger.log(u"Cache results: " + repr(curResults), logger.DEBUG) didSearch = True break - if not curResults: + if not len(curResults): for curProvider in providers.sortedProviderList(): if not curProvider.isActive(): continue try: - if not curResults: - curResults = curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch) - - # make a list of all the results for this provider - for curEp in curResults: - - # skip non-tv crap - curResults[curEp] = filter( - lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name,show),curResults[curEp]) - - if curEp in foundResults: - foundResults[curEp] += curResults[curEp] - else: - foundResults[curEp] = curResults[curEp] - + curResults.update(curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch)) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) continue @@ -419,6 +405,17 @@ def searchProviders(show, season, episode=None, manualSearch=False): didSearch = True + # make a list of all the results for this provider + for curEp in curResults: + # skip non-tv crap + curResults[curEp] = filter( + lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name,show),curResults[curEp]) + + if curEp in foundResults: + foundResults[curEp] += curResults[curEp] + else: + foundResults[curEp] = curResults[curEp] + if not didSearch: logger.log(u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.", logger.ERROR) diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index 210be6e1..2a4af4a1 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -251,7 +251,7 @@ class TVCache(): def searchCache(self, episode, manualSearch=False): neededEps = self.findNeededEpisodes(episode, manualSearch) - return neededEps[episode] + return neededEps def listPropers(self, date=None, delimiter="."): @@ -268,9 +268,6 @@ class TVCache(): def findNeededEpisodes(self, episode=None, manualSearch=False): neededEps = {} - if episode: - neededEps[episode] = [] - myDB = self._getDB() if not episode: