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,15 +1144,19 @@ def start():
searchQueueScheduler.start() searchQueueScheduler.start()
# start the queue checker # start the queue checker
if DOWNLOAD_PROPERS:
properFinderScheduler.start() properFinderScheduler.start()
# start the proper finder # start the proper finder
if PROCESS_AUTOMATICALLY:
autoPostProcesserScheduler.start() autoPostProcesserScheduler.start()
# start the subtitles finder # start the subtitles finder
if USE_SUBTITLES:
subtitlesFinderScheduler.start() subtitlesFinderScheduler.start()
# start the trakt checker # start the trakt checker
if USE_TRAKT:
traktCheckerScheduler.start() traktCheckerScheduler.start()
started = True started = True
@ -1220,6 +1224,7 @@ def halt():
except: except:
pass pass
if PROCESS_AUTOMATICALLY:
autoPostProcesserScheduler.stop.set() autoPostProcesserScheduler.stop.set()
logger.log(u"Waiting for the POSTPROCESSER thread to exit") logger.log(u"Waiting for the POSTPROCESSER thread to exit")
try: try:
@ -1227,6 +1232,7 @@ def halt():
except: except:
pass pass
if USE_TRAKT:
traktCheckerScheduler.stop.set() traktCheckerScheduler.stop.set()
logger.log(u"Waiting for the TRAKTCHECKER thread to exit") logger.log(u"Waiting for the TRAKTCHECKER thread to exit")
try: try:
@ -1234,6 +1240,7 @@ def halt():
except: except:
pass pass
if DOWNLOAD_PROPERS:
properFinderScheduler.stop.set() properFinderScheduler.stop.set()
logger.log(u"Waiting for the PROPERFINDER thread to exit") logger.log(u"Waiting for the PROPERFINDER thread to exit")
try: try:
@ -1241,6 +1248,7 @@ def halt():
except: except:
pass pass
if USE_SUBTITLES:
subtitlesFinderScheduler.stop.set() subtitlesFinderScheduler.stop.set()
logger.log(u"Waiting for the SUBTITLESFINDER thread to exit") logger.log(u"Waiting for the SUBTITLESFINDER thread to exit")
try: try:

View File

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

View File

@ -27,7 +27,6 @@ from sickbeard import helpers
from sickbeard import logger from sickbeard import logger
from sickbeard import naming from sickbeard import naming
from sickbeard import db from sickbeard import db
from sickbeard import version
naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d", naming_ep_type = ("%(seasonnumber)dx%(episodenumber)02d",
"s%(seasonnumber)02de%(episodenumber)02d", "s%(seasonnumber)02de%(episodenumber)02d",
@ -191,6 +190,51 @@ def change_VERSION_NOTIFY(version_notify):
if oldSetting == False and version_notify == True: if oldSetting == False and version_notify == True:
sickbeard.versionCheckScheduler.action.run() # @UndefinedVariable 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): def CheckSection(CFG, sec):
""" Check if INI section exists, if not create it """ """ Check if INI section exists, if not create it """
try: try:
@ -467,7 +511,7 @@ class ConfigMigrator():
if old_season_format: if old_season_format:
try: try:
new_season_format = old_season_format % 9 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') new_season_format = new_season_format.replace('9', '%S')
logger.log( logger.log(

View File

@ -39,7 +39,6 @@ class Scheduler(threading.Thread):
self.silent = silent self.silent = silent
self.stop = threading.Event() self.stop = threading.Event()
self.force = False self.force = False
self.daemon = False
def timeLeft(self): def timeLeft(self):
return self.cycleTime - (datetime.datetime.now() - self.lastRun) 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 and download subtitles. Only if the defined rule is true
""" """
def run(self, force=False): def run(self, force=False):
if not sickbeard.USE_SUBTITLES:
return
if len(sickbeard.subtitles.getEnabledServiceList()) < 1: 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) logger.log(u'Not enough services selected. At least 1 service is required to search subtitles in the background', logger.ERROR)
return return

View File

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