1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Doesn't start a scheduled task for things not enabled to not waste resources.

This commit is contained in:
echel0n 2014-07-28 19:20:48 -07:00
parent cdd190e1e7
commit b1de2c7080
6 changed files with 82 additions and 40 deletions

View File

@ -1144,16 +1144,20 @@ def start():
searchQueueScheduler.start()
# start the queue checker
properFinderScheduler.start()
if DOWNLOAD_PROPERS:
properFinderScheduler.start()
# start the proper finder
autoPostProcesserScheduler.start()
if PROCESS_AUTOMATICALLY:
autoPostProcesserScheduler.start()
# start the subtitles finder
subtitlesFinderScheduler.start()
if USE_SUBTITLES:
subtitlesFinderScheduler.start()
# start the trakt checker
traktCheckerScheduler.start()
if USE_TRAKT:
traktCheckerScheduler.start()
started = True
@ -1220,33 +1224,37 @@ def halt():
except:
pass
autoPostProcesserScheduler.stop.set()
logger.log(u"Waiting for the POSTPROCESSER thread to exit")
try:
autoPostProcesserScheduler.join(10)
except:
pass
if PROCESS_AUTOMATICALLY:
autoPostProcesserScheduler.stop.set()
logger.log(u"Waiting for the POSTPROCESSER thread to exit")
try:
autoPostProcesserScheduler.join(10)
except:
pass
traktCheckerScheduler.stop.set()
logger.log(u"Waiting for the TRAKTCHECKER thread to exit")
try:
traktCheckerScheduler.join(10)
except:
pass
if USE_TRAKT:
traktCheckerScheduler.stop.set()
logger.log(u"Waiting for the TRAKTCHECKER thread to exit")
try:
traktCheckerScheduler.join(10)
except:
pass
properFinderScheduler.stop.set()
logger.log(u"Waiting for the PROPERFINDER thread to exit")
try:
properFinderScheduler.join(10)
except:
pass
if DOWNLOAD_PROPERS:
properFinderScheduler.stop.set()
logger.log(u"Waiting for the PROPERFINDER thread to exit")
try:
properFinderScheduler.join(10)
except:
pass
subtitlesFinderScheduler.stop.set()
logger.log(u"Waiting for the SUBTITLESFINDER thread to exit")
try:
subtitlesFinderScheduler.join(10)
except:
pass
if USE_SUBTITLES:
subtitlesFinderScheduler.stop.set()
logger.log(u"Waiting for the SUBTITLESFINDER thread to exit")
try:
subtitlesFinderScheduler.join(10)
except:
pass
if ADBA_CONNECTION:
ADBA_CONNECTION.logout()

View File

@ -27,9 +27,6 @@ from sickbeard import processTV
class PostProcesser():
def run(self, force=False):
if not sickbeard.PROCESS_AUTOMATICALLY:
return
if not ek.ek(os.path.isdir, sickbeard.TV_DOWNLOAD_DIR):
logger.log(u"Automatic post-processing attempted but dir " + sickbeard.TV_DOWNLOAD_DIR + " doesn't exist",
logger.ERROR)

View File

@ -27,7 +27,6 @@ from sickbeard import helpers
from sickbeard import logger
from sickbeard import naming
from sickbeard import db
from sickbeard import version
naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d",
"s%(seasonnumber)02de%(episodenumber)02d",
@ -191,6 +190,51 @@ def change_VERSION_NOTIFY(version_notify):
if oldSetting == False and version_notify == True:
sickbeard.versionCheckScheduler.action.run() # @UndefinedVariable
def change_DOWNLOAD_PROPERS(download_propers):
if sickbeard.DOWNLOAD_PROPERS == download_propers:
return
sickbeard.DOWNLOAD_PROPERS = download_propers
if sickbeard.DOWNLOAD_PROPERS:
sickbeard.properFinderScheduler.start()
else:
sickbeard.properFinderScheduler.stop.set()
logger.log(u"Waiting for the PROPERFINDER thread to exit")
try:
sickbeard.properFinderScheduler.join(10)
except:
pass
def change_USE_TRAKT(use_trakt):
if sickbeard.USE_TRAKT == use_trakt:
return
sickbeard.USE_TRAKT = use_trakt
if sickbeard.USE_TRAKT:
sickbeard.traktCheckerScheduler.start()
else:
sickbeard.traktCheckerScheduler.stop.set()
logger.log(u"Waiting for the TRAKTCHECKER thread to exit")
try:
sickbeard.traktCheckerScheduler.join(10)
except:
pass
def change_USE_SUBTITLES(use_subtitles):
if sickbeard.USE_SUBTITLES == use_subtitles:
return
sickbeard.USE_SUBTITLES = use_subtitles
if sickbeard.USE_SUBTITLES:
sickbeard.subtitlesFinderScheduler.start()
else:
sickbeard.subtitlesFinderScheduler.stop.set()
logger.log(u"Waiting for the SUBTITLESFINDER thread to exit")
try:
sickbeard.subtitlesFinderScheduler.join(10)
except:
pass
def CheckSection(CFG, sec):
""" Check if INI section exists, if not create it """
try:
@ -467,7 +511,7 @@ class ConfigMigrator():
if old_season_format:
try:
new_season_format = old_season_format % 9
new_season_format = new_season_format.replace('09', '%0S')
new_season_format = str(new_season_format).replace('09', '%0S')
new_season_format = new_season_format.replace('9', '%S')
logger.log(

View File

@ -39,7 +39,6 @@ class Scheduler(threading.Thread):
self.silent = silent
self.stop = threading.Event()
self.force = False
self.daemon = False
def timeLeft(self):
return self.cycleTime - (datetime.datetime.now() - self.lastRun)

View File

@ -87,9 +87,6 @@ class SubtitlesFinder():
and download subtitles. Only if the defined rule is true
"""
def run(self, force=False):
if not sickbeard.USE_SUBTITLES:
return
if len(sickbeard.subtitles.getEnabledServiceList()) < 1:
logger.log(u'Not enough services selected. At least 1 service is required to search subtitles in the background', logger.ERROR)
return

View File

@ -34,9 +34,6 @@ class TraktChecker():
self.todoBacklog = []
def run(self, force=False):
if not sickbeard.USE_TRAKT:
return
try:
# add shows from trakt.tv watchlist
if sickbeard.TRAKT_USE_WATCHLIST: