Fixed whitelist error when editing shows, needs more code changes to fully function correctly.

Possible fix for threading exceptions.
This commit is contained in:
echel0n 2014-07-17 17:43:36 -07:00
parent 546f7c00b4
commit 7f20f5e27f
4 changed files with 37 additions and 32 deletions

View File

@ -144,7 +144,7 @@ Results without one of these words in the title will be filtered out <br />
Separate words with a comma, e.g. "word1,word2,word3"
<br /><br />
#if $show.is_anime
#if $show.is_anime:
#from sickbeard.blackandwhitelist import *
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_blackwhitelist.tmpl")
#end if

1
lib/adba/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.xml

View File

@ -31,15 +31,15 @@ class QueuePriorities:
class GenericQueue(object):
def __init__(self):
self.queueItem = None
self.currentItem = None
self.queue = []
self.queue_name = "QUEUE"
self.min_priority = 0
self.currentItem = None
self.lock = threading.Lock()
def pause(self):
@ -58,13 +58,14 @@ class GenericQueue(object):
def run(self, force=False):
# if the thread is dead then the current item should be finished
if self.currentItem is not None:
self.currentItem.finish()
self.currentItem = None
# only start a new task if one isn't already going
if not self.currentItem or not self.currentItem.isAlive():
if self.queueItem is None or not self.queueItem.isAlive():
# if the thread is dead then the current item should be finished
if self.currentItem != None:
self.currentItem.finish()
self.currentItem = None
# if there's something in the queue then run it in a thread and take it out of the queue
if len(self.queue) > 0:
@ -109,13 +110,13 @@ class QueueItem(threading.Thread):
self.priority = QueuePriorities.NORMAL
self.action_id = action_id
self.added = None
self.alive = True
self.stop = threading.Event()
def run(self):
"""Implementing classes should call this"""
self.inProgress = True
self.alive = True
def finish(self):
"""Implementing Classes should call this"""

View File

@ -3659,31 +3659,34 @@ 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)