mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 11:32:20 -05: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
@ -35,8 +35,8 @@ __all__ = ['ezrss',
|
|||||||
]
|
]
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
import generic
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
|
|
||||||
from os import sys
|
from os import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,32 +383,18 @@ def searchProviders(show, season, episode=None, manualSearch=False):
|
|||||||
curResults.update(results)
|
curResults.update(results)
|
||||||
|
|
||||||
# did we find our results ?
|
# did we find our results ?
|
||||||
if curResults:
|
if len(curResults):
|
||||||
logger.log(u"Cache results: " + str(curResults), logger.DEBUG)
|
logger.log(u"Cache results: " + repr(curResults), logger.DEBUG)
|
||||||
didSearch = True
|
didSearch = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if not curResults:
|
if not len(curResults):
|
||||||
for curProvider in providers.sortedProviderList():
|
for curProvider in providers.sortedProviderList():
|
||||||
if not curProvider.isActive():
|
if not curProvider.isActive():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not curResults:
|
curResults.update(curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch))
|
||||||
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]
|
|
||||||
|
|
||||||
except exceptions.AuthException, e:
|
except exceptions.AuthException, e:
|
||||||
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
|
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
|
||||||
continue
|
continue
|
||||||
@ -419,6 +405,17 @@ def searchProviders(show, season, episode=None, manualSearch=False):
|
|||||||
|
|
||||||
didSearch = True
|
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:
|
if not didSearch:
|
||||||
logger.log(u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
|
logger.log(u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
|
||||||
logger.ERROR)
|
logger.ERROR)
|
||||||
|
@ -251,7 +251,7 @@ class TVCache():
|
|||||||
|
|
||||||
def searchCache(self, episode, manualSearch=False):
|
def searchCache(self, episode, manualSearch=False):
|
||||||
neededEps = self.findNeededEpisodes(episode, manualSearch)
|
neededEps = self.findNeededEpisodes(episode, manualSearch)
|
||||||
return neededEps[episode]
|
return neededEps
|
||||||
|
|
||||||
def listPropers(self, date=None, delimiter="."):
|
def listPropers(self, date=None, delimiter="."):
|
||||||
|
|
||||||
@ -268,9 +268,6 @@ class TVCache():
|
|||||||
def findNeededEpisodes(self, episode=None, manualSearch=False):
|
def findNeededEpisodes(self, episode=None, manualSearch=False):
|
||||||
neededEps = {}
|
neededEps = {}
|
||||||
|
|
||||||
if episode:
|
|
||||||
neededEps[episode] = []
|
|
||||||
|
|
||||||
myDB = self._getDB()
|
myDB = self._getDB()
|
||||||
|
|
||||||
if not episode:
|
if not episode:
|
||||||
|
Loading…
Reference in New Issue
Block a user