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)
|
self.queue.sort(cmp=sorter)
|
||||||
|
|
||||||
queueItem = self.queue[0]
|
queueItem = self.queue.pop(0)
|
||||||
|
|
||||||
if queueItem.priority < self.min_priority:
|
if queueItem.priority < self.min_priority:
|
||||||
return
|
return
|
||||||
|
@ -97,9 +97,7 @@ class GenericQueue(object):
|
||||||
|
|
||||||
self.currentItem = queueItem
|
self.currentItem = queueItem
|
||||||
|
|
||||||
# take it out of the queue
|
queueItem.join()
|
||||||
del self.queue[0]
|
|
||||||
|
|
||||||
|
|
||||||
class QueueItem(threading.Thread):
|
class QueueItem(threading.Thread):
|
||||||
def __init__(self, name, action_id=0):
|
def __init__(self, name, action_id=0):
|
||||||
|
@ -116,10 +114,8 @@ class QueueItem(threading.Thread):
|
||||||
"""Implementing classes should call this"""
|
"""Implementing classes should call this"""
|
||||||
|
|
||||||
self.inProgress = True
|
self.inProgress = True
|
||||||
self.alive = True
|
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
"""Implementing Classes should call this"""
|
"""Implementing Classes should call this"""
|
||||||
|
|
||||||
self.inProgress = False
|
self.inProgress = False
|
||||||
self.alive = False
|
|
|
@ -88,6 +88,7 @@ class SearchQueue(generic_queue.GenericQueue):
|
||||||
else:
|
else:
|
||||||
logger.log(u"Not adding item, it's already in the queue", logger.DEBUG)
|
logger.log(u"Not adding item, it's already in the queue", logger.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
class DailySearchQueueItem(generic_queue.QueueItem):
|
class DailySearchQueueItem(generic_queue.QueueItem):
|
||||||
def __init__(self, show, segment):
|
def __init__(self, show, segment):
|
||||||
generic_queue.QueueItem.__init__(self, 'Daily Search', DAILY_SEARCH)
|
generic_queue.QueueItem.__init__(self, 'Daily Search', DAILY_SEARCH)
|
||||||
|
@ -123,6 +124,9 @@ class DailySearchQueueItem(generic_queue.QueueItem):
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
|
|
||||||
|
self.finish()
|
||||||
|
|
||||||
|
|
||||||
class ManualSearchQueueItem(generic_queue.QueueItem):
|
class ManualSearchQueueItem(generic_queue.QueueItem):
|
||||||
def __init__(self, show, segment):
|
def __init__(self, show, segment):
|
||||||
generic_queue.QueueItem.__init__(self, 'Manual Search', MANUAL_SEARCH)
|
generic_queue.QueueItem.__init__(self, 'Manual Search', MANUAL_SEARCH)
|
||||||
|
@ -159,12 +163,16 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
|
|
||||||
|
self.finish()
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
# don't let this linger if something goes wrong
|
# don't let this linger if something goes wrong
|
||||||
if self.success == None:
|
if self.success is None:
|
||||||
self.success = False
|
self.success = False
|
||||||
|
|
||||||
generic_queue.QueueItem.finish(self)
|
generic_queue.QueueItem.finish(self)
|
||||||
|
|
||||||
|
|
||||||
class BacklogQueueItem(generic_queue.QueueItem):
|
class BacklogQueueItem(generic_queue.QueueItem):
|
||||||
def __init__(self, show, segment):
|
def __init__(self, show, segment):
|
||||||
generic_queue.QueueItem.__init__(self, 'Backlog', BACKLOG_SEARCH)
|
generic_queue.QueueItem.__init__(self, 'Backlog', BACKLOG_SEARCH)
|
||||||
|
@ -177,13 +185,13 @@ class BacklogQueueItem(generic_queue.QueueItem):
|
||||||
def run(self):
|
def run(self):
|
||||||
generic_queue.QueueItem.run(self)
|
generic_queue.QueueItem.run(self)
|
||||||
|
|
||||||
for season in self.segment:
|
try:
|
||||||
sickbeard.searchBacklog.BacklogSearcher.currentSearchInfo = {
|
for season in self.segment:
|
||||||
'title': self.show.name + " Season " + str(season)}
|
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 + "]")
|
logger.log("Beginning backlog search for [" + self.show.name + "]")
|
||||||
searchResult = search.searchProviders(self.show, season, wantedEps, False)
|
searchResult = search.searchProviders(self.show, season, wantedEps, False)
|
||||||
|
|
||||||
|
@ -201,9 +209,8 @@ class BacklogQueueItem(generic_queue.QueueItem):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.log(u"No needed episodes found during backlog search for [" + self.show.name + "]")
|
logger.log(u"No needed episodes found during backlog search for [" + self.show.name + "]")
|
||||||
|
except Exception:
|
||||||
except Exception:
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
|
||||||
|
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
|
|
|
@ -423,8 +423,8 @@ class QueueItemRefresh(ShowQueueItem):
|
||||||
|
|
||||||
self.show.refreshDir()
|
self.show.refreshDir()
|
||||||
self.show.writeMetadata()
|
self.show.writeMetadata()
|
||||||
if self.force:
|
#if self.force:
|
||||||
self.show.updateMetadata()
|
# self.show.updateMetadata()
|
||||||
self.show.populateCache()
|
self.show.populateCache()
|
||||||
|
|
||||||
# Load XEM data to DB for show
|
# Load XEM data to DB for show
|
||||||
|
|
|
@ -3659,34 +3659,33 @@ class Home(MainHandler):
|
||||||
t = PageTemplate(headers=self.request.headers, file="editShow.tmpl")
|
t = PageTemplate(headers=self.request.headers, file="editShow.tmpl")
|
||||||
t.submenu = HomeMenu()
|
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:
|
with showObj.lock:
|
||||||
t.show = showObj
|
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)
|
t.scene_exceptions = get_scene_exceptions(showObj.indexerid)
|
||||||
|
|
||||||
return _munge(t)
|
return _munge(t)
|
||||||
|
|
Loading…
Reference in a new issue