1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 02:52:20 -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() searchQueueScheduler.start()
# start the queue checker # start the queue checker
properFinderScheduler.start() if DOWNLOAD_PROPERS:
properFinderScheduler.start()
# start the proper finder # start the proper finder
autoPostProcesserScheduler.start() if PROCESS_AUTOMATICALLY:
autoPostProcesserScheduler.start()
# start the subtitles finder # start the subtitles finder
subtitlesFinderScheduler.start() if USE_SUBTITLES:
subtitlesFinderScheduler.start()
# start the trakt checker # start the trakt checker
traktCheckerScheduler.start() if USE_TRAKT:
traktCheckerScheduler.start()
started = True started = True
@ -1220,33 +1224,37 @@ def halt():
except: except:
pass pass
autoPostProcesserScheduler.stop.set() if PROCESS_AUTOMATICALLY:
logger.log(u"Waiting for the POSTPROCESSER thread to exit") autoPostProcesserScheduler.stop.set()
try: logger.log(u"Waiting for the POSTPROCESSER thread to exit")
autoPostProcesserScheduler.join(10) try:
except: autoPostProcesserScheduler.join(10)
pass except:
pass
traktCheckerScheduler.stop.set() if USE_TRAKT:
logger.log(u"Waiting for the TRAKTCHECKER thread to exit") traktCheckerScheduler.stop.set()
try: logger.log(u"Waiting for the TRAKTCHECKER thread to exit")
traktCheckerScheduler.join(10) try:
except: traktCheckerScheduler.join(10)
pass except:
pass
properFinderScheduler.stop.set() if DOWNLOAD_PROPERS:
logger.log(u"Waiting for the PROPERFINDER thread to exit") properFinderScheduler.stop.set()
try: logger.log(u"Waiting for the PROPERFINDER thread to exit")
properFinderScheduler.join(10) try:
except: properFinderScheduler.join(10)
pass except:
pass
subtitlesFinderScheduler.stop.set() if USE_SUBTITLES:
logger.log(u"Waiting for the SUBTITLESFINDER thread to exit") subtitlesFinderScheduler.stop.set()
try: logger.log(u"Waiting for the SUBTITLESFINDER thread to exit")
subtitlesFinderScheduler.join(10) try:
except: subtitlesFinderScheduler.join(10)
pass except:
pass
if ADBA_CONNECTION: if ADBA_CONNECTION:
ADBA_CONNECTION.logout() ADBA_CONNECTION.logout()

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: