From 0cdd1cf8137bbe670384f5c3b50ba2bf96ea2769 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 19 Jul 2014 17:03:23 -0700 Subject: [PATCH] Fix for threading schedualers and subtitles. --- sickbeard/event_queue.py | 1 - sickbeard/scheduler.py | 1 - sickbeard/webserve.py | 11 +++++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sickbeard/event_queue.py b/sickbeard/event_queue.py index 4955c603..aeb0c000 100644 --- a/sickbeard/event_queue.py +++ b/sickbeard/event_queue.py @@ -14,7 +14,6 @@ class Events(threading.Thread): super(Events, self).__init__() self.queue = Queue() self.daemon = True - self.alive = True self.callback = callback self.name = "EVENT-QUEUE" self.stop = threading.Event() diff --git a/sickbeard/scheduler.py b/sickbeard/scheduler.py index 532d4af8..40289643 100644 --- a/sickbeard/scheduler.py +++ b/sickbeard/scheduler.py @@ -39,7 +39,6 @@ class Scheduler(threading.Thread): self.silent = silent self.stop = threading.Event() self.force = False - self.alive = True def timeLeft(self): return self.cycleTime - (datetime.datetime.now() - self.lastRun) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 270252ab..ce809a12 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -2398,22 +2398,21 @@ class ConfigSubtitles(MainHandler): if subtitles_finder_frequency == '' or subtitles_finder_frequency is None: subtitles_finder_frequency = 1 - if use_subtitles == "on": - if not sickbeard.subtitlesFinderScheduler.isAlive(): - sickbeard.subtitlesFinderScheduler.silent = False - sickbeard.subtitlesFinderScheduler.start() + if use_subtitles == "on" and not sickbeard.subtitlesFinderScheduler.isAlive(): + sickbeard.subtitlesFinderScheduler.silent = False + sickbeard.subtitlesFinderScheduler.start() else: sickbeard.subtitlesFinderScheduler.stop.set() sickbeard.subtitlesFinderScheduler.silent = True logger.log(u"Waiting for the SUBTITLESFINDER thread to exit") try: - sickbeard.subtitlesFinderScheduler.join() + sickbeard.subtitlesFinderScheduler.join(5) except: pass sickbeard.USE_SUBTITLES = config.checkbox_to_value(use_subtitles) sickbeard.SUBTITLES_LANGUAGES = [lang.alpha2 for lang in subtitles.isValidLanguage( - subtitles_languages.replace(' ', '').split(','))] if subtitles_languages != '' else '' + subtitles_languages.replace(' ', '').split(','))] if subtitles_languages != '' else '' sickbeard.SUBTITLES_DIR = subtitles_dir sickbeard.SUBTITLES_HISTORY = config.checkbox_to_value(subtitles_history) sickbeard.SUBTITLES_FINDER_FREQUENCY = config.to_int(subtitles_finder_frequency, default=1)