mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fix for possible infinitie loop in searches
This commit is contained in:
parent
0afdeb3c1f
commit
905d2b4eaf
@ -95,18 +95,23 @@ class DailySearcher():
|
||||
|
||||
# ask all providers for any episodes it finds
|
||||
threadName = threading.currentThread().name
|
||||
for curProvider in [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]:
|
||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
|
||||
for curProviderCount, curProvider in enumerate(providers):
|
||||
threading.currentThread().name = threadName + ":[" + curProvider.name + "]"
|
||||
|
||||
try:
|
||||
curFoundResults = curProvider.searchRSS()
|
||||
except exceptions.AuthException, e:
|
||||
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
|
||||
continue
|
||||
if curProviderCount != len(providers):
|
||||
continue
|
||||
break
|
||||
except Exception, e:
|
||||
logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
continue
|
||||
if curProviderCount != len(providers):
|
||||
continue
|
||||
break
|
||||
|
||||
didSearch = True
|
||||
|
||||
@ -143,4 +148,4 @@ class DailySearcher():
|
||||
u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
|
||||
logger.ERROR)
|
||||
|
||||
return foundResults.values()
|
||||
return foundResults.values() if len(foundResults) else {}
|
@ -354,11 +354,11 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
|
||||
searchResults = provider.findSearchResults(show, season, episodes, search_mode, manualSearch)
|
||||
except exceptions.AuthException, e:
|
||||
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
|
||||
continue
|
||||
break
|
||||
except Exception, e:
|
||||
logger.log(u"Error while searching " + provider.name + ", skipping: " + ex(e), logger.ERROR)
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
continue
|
||||
break
|
||||
|
||||
if len(searchResults):
|
||||
foundResults[provider.name] = filterSearchResults(show, searchResults)
|
||||
@ -375,7 +375,10 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
|
||||
|
||||
# skip to next provider if we have no results to process
|
||||
if not len(foundResults[provider.name]):
|
||||
continue
|
||||
if providerNum != len(providers):
|
||||
continue
|
||||
break
|
||||
|
||||
|
||||
anyQualities, bestQualities = Quality.splitQuality(show.quality)
|
||||
|
||||
@ -580,7 +583,7 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
|
||||
wantedEpCount += 1
|
||||
|
||||
# make sure we search every provider for results unless we found everything we wanted
|
||||
if providerNum != len(providers) and wantedEpCount != len(episodes):
|
||||
continue
|
||||
if providerNum == len(providers) or wantedEpCount == len(episodes):
|
||||
break
|
||||
|
||||
return queueItem
|
Loading…
Reference in New Issue
Block a user