mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fix for threading issues with backlogs and whitelist/blacklist issues for anime shows.
This commit is contained in:
parent
a435a7d3d2
commit
5bc775dfb9
4 changed files with 45 additions and 43 deletions
|
@ -86,7 +86,7 @@ class GenericQueue(object):
|
|||
|
||||
self.queue.sort(cmp=sorter)
|
||||
|
||||
queueItem = self.queue[0]
|
||||
queueItem = self.queue.pop(0)
|
||||
|
||||
if queueItem.priority < self.min_priority:
|
||||
return
|
||||
|
@ -97,9 +97,7 @@ class GenericQueue(object):
|
|||
|
||||
self.currentItem = queueItem
|
||||
|
||||
# take it out of the queue
|
||||
del self.queue[0]
|
||||
|
||||
queueItem.join()
|
||||
|
||||
class QueueItem(threading.Thread):
|
||||
def __init__(self, name, action_id=0):
|
||||
|
@ -116,10 +114,8 @@ class QueueItem(threading.Thread):
|
|||
"""Implementing classes should call this"""
|
||||
|
||||
self.inProgress = True
|
||||
self.alive = True
|
||||
|
||||
def finish(self):
|
||||
"""Implementing Classes should call this"""
|
||||
|
||||
self.inProgress = False
|
||||
self.alive = False
|
|
@ -88,6 +88,7 @@ class SearchQueue(generic_queue.GenericQueue):
|
|||
else:
|
||||
logger.log(u"Not adding item, it's already in the queue", logger.DEBUG)
|
||||
|
||||
|
||||
class DailySearchQueueItem(generic_queue.QueueItem):
|
||||
def __init__(self, show, segment):
|
||||
generic_queue.QueueItem.__init__(self, 'Daily Search', DAILY_SEARCH)
|
||||
|
@ -123,6 +124,9 @@ class DailySearchQueueItem(generic_queue.QueueItem):
|
|||
except Exception:
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
|
||||
self.finish()
|
||||
|
||||
|
||||
class ManualSearchQueueItem(generic_queue.QueueItem):
|
||||
def __init__(self, show, segment):
|
||||
generic_queue.QueueItem.__init__(self, 'Manual Search', MANUAL_SEARCH)
|
||||
|
@ -159,12 +163,16 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
|
|||
except Exception:
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
|
||||
self.finish()
|
||||
|
||||
def finish(self):
|
||||
# don't let this linger if something goes wrong
|
||||
if self.success == None:
|
||||
if self.success is None:
|
||||
self.success = False
|
||||
|
||||
generic_queue.QueueItem.finish(self)
|
||||
|
||||
|
||||
class BacklogQueueItem(generic_queue.QueueItem):
|
||||
def __init__(self, show, segment):
|
||||
generic_queue.QueueItem.__init__(self, 'Backlog', BACKLOG_SEARCH)
|
||||
|
@ -177,13 +185,13 @@ class BacklogQueueItem(generic_queue.QueueItem):
|
|||
def run(self):
|
||||
generic_queue.QueueItem.run(self)
|
||||
|
||||
for season in self.segment:
|
||||
sickbeard.searchBacklog.BacklogSearcher.currentSearchInfo = {
|
||||
'title': self.show.name + " Season " + str(season)}
|
||||
try:
|
||||
for season in self.segment:
|
||||
sickbeard.searchBacklog.BacklogSearcher.currentSearchInfo = {
|
||||
'title': self.show.name + " Season " + str(season)}
|
||||
|
||||
wantedEps = self.segment[season]
|
||||
wantedEps = self.segment[season]
|
||||
|
||||
try:
|
||||
logger.log("Beginning backlog search for [" + self.show.name + "]")
|
||||
searchResult = search.searchProviders(self.show, season, wantedEps, False)
|
||||
|
||||
|
@ -201,9 +209,8 @@ class BacklogQueueItem(generic_queue.QueueItem):
|
|||
|
||||
else:
|
||||
logger.log(u"No needed episodes found during backlog search for [" + self.show.name + "]")
|
||||
|
||||
except Exception:
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
except Exception:
|
||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||
|
||||
self.finish()
|
||||
|
||||
|
|
|
@ -423,8 +423,8 @@ class QueueItemRefresh(ShowQueueItem):
|
|||
|
||||
self.show.refreshDir()
|
||||
self.show.writeMetadata()
|
||||
if self.force:
|
||||
self.show.updateMetadata()
|
||||
#if self.force:
|
||||
# self.show.updateMetadata()
|
||||
self.show.populateCache()
|
||||
|
||||
# Load XEM data to DB for show
|
||||
|
|
|
@ -3659,34 +3659,33 @@ class Home(MainHandler):
|
|||
t = PageTemplate(headers=self.request.headers, file="editShow.tmpl")
|
||||
t.submenu = HomeMenu()
|
||||
|
||||
if showObj.is_anime:
|
||||
bwl = BlackAndWhiteList(showObj.indexerid)
|
||||
|
||||
t.whiteWords = ""
|
||||
if "global" in bwl.whiteDict:
|
||||
t.whiteWords = ", ".join(bwl.whiteDict["global"])
|
||||
|
||||
t.blackWords = ""
|
||||
if "global" in bwl.blackDict:
|
||||
t.blackWords = ", ".join(bwl.blackDict["global"])
|
||||
|
||||
t.whitelist = []
|
||||
if bwl.whiteDict.has_key("release_group"):
|
||||
t.whitelist = bwl.whiteDict["release_group"]
|
||||
|
||||
t.blacklist = []
|
||||
if bwl.blackDict.has_key("release_group"):
|
||||
t.blacklist = bwl.blackDict["release_group"]
|
||||
|
||||
t.groups = []
|
||||
if helpers.set_up_anidb_connection():
|
||||
anime = adba.Anime(sickbeard.ADBA_CONNECTION, name=showObj.name)
|
||||
t.groups = anime.get_groups()
|
||||
|
||||
with showObj.lock:
|
||||
t.show = showObj
|
||||
|
||||
if showObj.is_anime:
|
||||
t.whiteWords = ""
|
||||
t.whitelist = []
|
||||
|
||||
t.blackWords = ""
|
||||
t.blacklist = []
|
||||
|
||||
t.groups = []
|
||||
|
||||
bwl = BlackAndWhiteList(showObj.indexerid)
|
||||
if "global" in bwl.whiteDict:
|
||||
t.whiteWords = ", ".join(bwl.whiteDict["global"])
|
||||
if "global" in bwl.blackDict:
|
||||
t.blackWords = ", ".join(bwl.blackDict["global"])
|
||||
|
||||
if bwl.whiteDict.has_key("release_group"):
|
||||
t.whitelist = bwl.whiteDict["release_group"]
|
||||
|
||||
if bwl.blackDict.has_key("release_group"):
|
||||
t.blacklist = bwl.blackDict["release_group"]
|
||||
|
||||
if helpers.set_up_anidb_connection():
|
||||
anime = adba.Anime(sickbeard.ADBA_CONNECTION, name=showObj.name)
|
||||
t.groups = anime.get_groups()
|
||||
|
||||
t.scene_exceptions = get_scene_exceptions(showObj.indexerid)
|
||||
|
||||
return _munge(t)
|
||||
|
|
Loading…
Reference in a new issue