1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 11:32:20 -05:00

Merge branch 'origin/dev'

This commit is contained in:
echel0n 2014-05-12 04:10:55 -07:00
commit 770747d23f
3 changed files with 10 additions and 16 deletions

View File

@ -48,10 +48,7 @@ class GenericQueue:
self.queue.put(item) self.queue.put(item)
return item return item
def run(self, queue=None): def run(self):
# dynamically set queue
if queue:
self.queue = queue
# only start a new task if one isn't already going # only start a new task if one isn't already going
if self.thread == None or self.thread.isAlive() == False: if self.thread == None or self.thread.isAlive() == False:
@ -68,6 +65,8 @@ class GenericQueue:
threadName = self.queue_name + '-' + queueItem.get_thread_name() threadName = self.queue_name + '-' + queueItem.get_thread_name()
self.thread = threading.Thread(None, queueItem.execute, threadName) self.thread = threading.Thread(None, queueItem.execute, threadName)
self.thread.start()
self.currentItem = queueItem self.currentItem = queueItem
class QueueItem: class QueueItem:

View File

@ -230,16 +230,16 @@ class GenericProvider:
itemList = [] itemList = []
for epObj in episodes: 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 not epObj.show.air_by_date:
if epObj.scene_season == 0 or epObj.scene_episode == 0: if epObj.scene_season == 0 or epObj.scene_episode == 0:
logger.log(u"Incomplete Indexer <-> Scene mapping detected for " + epObj.prettyName() + ", skipping search!") logger.log(u"Incomplete Indexer <-> Scene mapping detected for " + epObj.prettyName() + ", skipping search!")
continue continue
cacheResult = self.cache.searchCache(epObj, manualSearch)
if len(cacheResult):
results.update(cacheResult)
continue
if seasonSearch: if seasonSearch:
for curString in self._get_season_search_strings(epObj): for curString in self._get_season_search_strings(epObj):
itemList += self._doSearch(curString, len(episodes)) itemList += self._doSearch(curString, len(episodes))

View File

@ -27,7 +27,7 @@ from sickbeard.exceptions import ex
class Scheduler: class Scheduler:
def __init__(self, action, cycleTime=datetime.timedelta(minutes=10), runImmediately=True, 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: if runImmediately:
self.lastRun = datetime.datetime.fromordinal(1) self.lastRun = datetime.datetime.fromordinal(1)
@ -45,7 +45,6 @@ class Scheduler:
self.abort = False self.abort = False
self.runOnce = runOnce self.runOnce = runOnce
self.queue = queue
def initThread(self): def initThread(self):
if self.thread == None or not self.thread.isAlive(): if self.thread == None or not self.thread.isAlive():
@ -72,10 +71,6 @@ class Scheduler:
if not self.silent: if not self.silent:
logger.log(u"Starting new thread: " + self.threadName, logger.DEBUG) 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: except Exception, e:
logger.log(u"Exception generated in thread " + self.threadName + ": " + ex(e), logger.ERROR) logger.log(u"Exception generated in thread " + self.threadName + ": " + ex(e), logger.ERROR)