mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-05 19:08:02 -05:00
Merge pull request #824 from adam111316/thread_dailysearch
Threads dailysearcher process for each provider. Allows dailysearcher to...
This commit is contained in:
commit
fc96e5a7d6
@ -363,6 +363,7 @@ def searchForNeededEpisodes():
|
|||||||
didSearch = False
|
didSearch = False
|
||||||
|
|
||||||
origThreadName = threading.currentThread().name
|
origThreadName = threading.currentThread().name
|
||||||
|
threads = []
|
||||||
|
|
||||||
show_list = sickbeard.showList
|
show_list = sickbeard.showList
|
||||||
fromDate = datetime.date.fromordinal(1)
|
fromDate = datetime.date.fromordinal(1)
|
||||||
@ -377,20 +378,20 @@ def searchForNeededEpisodes():
|
|||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_daily]
|
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive() and x.enable_daily]
|
||||||
for curProvider in providers:
|
for curProvider in providers:
|
||||||
|
|
||||||
|
# spawn separate threads for each provider so we don't need to wait for providers with slow network operation
|
||||||
|
threads.append(threading.Thread(target=curProvider.cache.updateCache, name=origThreadName +
|
||||||
|
" :: [" + curProvider.name + "]"))
|
||||||
|
# start the thread we just created
|
||||||
|
threads[-1].start()
|
||||||
|
|
||||||
|
# wait for all threads to finish
|
||||||
|
for t in threads:
|
||||||
|
t.join()
|
||||||
|
|
||||||
|
for curProvider in providers:
|
||||||
threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]"
|
threading.currentThread().name = origThreadName + " :: [" + curProvider.name + "]"
|
||||||
|
|
||||||
try:
|
curFoundResults = curProvider.searchRSS(episodes)
|
||||||
curProvider.cache.updateCache()
|
|
||||||
curFoundResults = curProvider.searchRSS(episodes)
|
|
||||||
except exceptions.AuthException, e:
|
|
||||||
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
|
|
||||||
continue
|
|
||||||
except Exception, e:
|
|
||||||
logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
|
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
|
||||||
continue
|
|
||||||
finally:
|
|
||||||
threading.currentThread().name = origThreadName
|
|
||||||
|
|
||||||
didSearch = True
|
didSearch = True
|
||||||
|
|
||||||
@ -430,6 +431,8 @@ def searchForNeededEpisodes():
|
|||||||
|
|
||||||
foundResults[curEp] = bestResult
|
foundResults[curEp] = bestResult
|
||||||
|
|
||||||
|
threading.currentThread().name = origThreadName
|
||||||
|
|
||||||
if not didSearch:
|
if not didSearch:
|
||||||
logger.log(
|
logger.log(
|
||||||
u"No NZB/Torrent providers found or enabled in the sickrage config for daily searches. Please check your settings.",
|
u"No NZB/Torrent providers found or enabled in the sickrage config for daily searches. Please check your settings.",
|
||||||
|
Loading…
Reference in New Issue
Block a user