From 7c9e4b24d51929f021affcefaaa4ccdec3d938fc Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 12 May 2014 04:10:45 -0700 Subject: [PATCH] Fix for backlog and manual searches not being executed --- sickbeard/generic_queue.py | 7 +++---- sickbeard/providers/generic.py | 10 +++++----- sickbeard/scheduler.py | 9 ++------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/sickbeard/generic_queue.py b/sickbeard/generic_queue.py index 9819e2d4..f0f0d8bc 100644 --- a/sickbeard/generic_queue.py +++ b/sickbeard/generic_queue.py @@ -48,10 +48,7 @@ class GenericQueue: self.queue.put(item) return item - def run(self, queue=None): - # dynamically set queue - if queue: - self.queue = queue + def run(self): # only start a new task if one isn't already going if self.thread == None or self.thread.isAlive() == False: @@ -68,6 +65,8 @@ class GenericQueue: threadName = self.queue_name + '-' + queueItem.get_thread_name() self.thread = threading.Thread(None, queueItem.execute, threadName) + self.thread.start() + self.currentItem = queueItem class QueueItem: diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index cc47dbb5..5cb12a62 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -230,16 +230,16 @@ class GenericProvider: itemList = [] for epObj in episodes: - cacheResult = self.cache.searchCache(epObj, manualSearch) - if len(cacheResult): - results.update(cacheResult) - continue - if not epObj.show.air_by_date: if epObj.scene_season == 0 or epObj.scene_episode == 0: logger.log(u"Incomplete Indexer <-> Scene mapping detected for " + epObj.prettyName() + ", skipping search!") continue + cacheResult = self.cache.searchCache(epObj, manualSearch) + if len(cacheResult): + results.update(cacheResult) + continue + if seasonSearch: for curString in self._get_season_search_strings(epObj): itemList += self._doSearch(curString, len(episodes)) diff --git a/sickbeard/scheduler.py b/sickbeard/scheduler.py index 520d51e8..7f8781e0 100644 --- a/sickbeard/scheduler.py +++ b/sickbeard/scheduler.py @@ -27,7 +27,7 @@ from sickbeard.exceptions import ex class Scheduler: def __init__(self, action, cycleTime=datetime.timedelta(minutes=10), runImmediately=True, - threadName="ScheduledThread", silent=False, runOnce=False, queue=None): + threadName="ScheduledThread", silent=False, runOnce=False): if runImmediately: self.lastRun = datetime.datetime.fromordinal(1) @@ -45,7 +45,6 @@ class Scheduler: self.abort = False self.runOnce = runOnce - self.queue = queue def initThread(self): if self.thread == None or not self.thread.isAlive(): @@ -72,11 +71,7 @@ class Scheduler: if not self.silent: logger.log(u"Starting new thread: " + self.threadName, logger.DEBUG) - # check if we want to pass in our queue dynamically - if self.queue: - self.action.run(self.queue) - else: - self.action.run() + self.action.run() except Exception, e: logger.log(u"Exception generated in thread " + self.threadName + ": " + ex(e), logger.ERROR) logger.log(repr(traceback.format_exc()), logger.DEBUG)