mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Fixed issue #221
Manual and Backlog searches now gather all the search results FIRST then loop through them filtering the bad ones out, this should improve overall speed of searching for downloads.
This commit is contained in:
parent
e6056c5745
commit
f6cf80aa99
3 changed files with 17 additions and 23 deletions
|
@ -35,8 +35,8 @@ __all__ = ['ezrss',
|
|||
]
|
||||
|
||||
import sickbeard
|
||||
import generic
|
||||
from sickbeard import logger
|
||||
|
||||
from os import sys
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue