mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 19:12:26 -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
|
# ask all providers for any episodes it finds
|
||||||
threadName = threading.currentThread().name
|
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 + "]"
|
threading.currentThread().name = threadName + ":[" + curProvider.name + "]"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
curFoundResults = curProvider.searchRSS()
|
curFoundResults = curProvider.searchRSS()
|
||||||
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
|
if curProviderCount != len(providers):
|
||||||
|
continue
|
||||||
|
break
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
|
logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
continue
|
if curProviderCount != len(providers):
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
didSearch = True
|
didSearch = True
|
||||||
|
|
||||||
@ -143,4 +148,4 @@ class DailySearcher():
|
|||||||
u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
|
u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
|
||||||
logger.ERROR)
|
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)
|
searchResults = provider.findSearchResults(show, season, episodes, search_mode, manualSearch)
|
||||||
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
|
break
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.log(u"Error while searching " + provider.name + ", skipping: " + ex(e), logger.ERROR)
|
logger.log(u"Error while searching " + provider.name + ", skipping: " + ex(e), logger.ERROR)
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
continue
|
break
|
||||||
|
|
||||||
if len(searchResults):
|
if len(searchResults):
|
||||||
foundResults[provider.name] = filterSearchResults(show, 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
|
# skip to next provider if we have no results to process
|
||||||
if not len(foundResults[provider.name]):
|
if not len(foundResults[provider.name]):
|
||||||
continue
|
if providerNum != len(providers):
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
anyQualities, bestQualities = Quality.splitQuality(show.quality)
|
anyQualities, bestQualities = Quality.splitQuality(show.quality)
|
||||||
|
|
||||||
@ -580,7 +583,7 @@ def searchProviders(queueItem, show, season, episodes, manualSearch=False):
|
|||||||
wantedEpCount += 1
|
wantedEpCount += 1
|
||||||
|
|
||||||
# make sure we search every provider for results unless we found everything we wanted
|
# make sure we search every provider for results unless we found everything we wanted
|
||||||
if providerNum != len(providers) and wantedEpCount != len(episodes):
|
if providerNum == len(providers) or wantedEpCount == len(episodes):
|
||||||
continue
|
break
|
||||||
|
|
||||||
return queueItem
|
return queueItem
|
Loading…
Reference in New Issue
Block a user