1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -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)
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:

View File

@ -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))

View File

@ -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)