diff --git a/sickbeard/generic_queue.py b/sickbeard/generic_queue.py index 4ecfbdd3..92018ea6 100644 --- a/sickbeard/generic_queue.py +++ b/sickbeard/generic_queue.py @@ -111,7 +111,7 @@ class QueueItem(threading.Thread): self.added = None self.alive = True self.stop = threading.Event() - + def run(self): """Implementing classes should call this""" diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 7c926e7d..6f33b2cc 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -583,23 +583,24 @@ class NameParserCache: self.npc_cache_size = 200 try: - self.npc = shelve.open(ek.ek(os.path.join, sickbeard.CACHE_DIR, 'npc.db')) + self.npc = shelve.open(ek.ek(os.path.join, sickbeard.CACHE_DIR, 'name_parser_cache')) except Exception as e: logger.log(u"NameParser Cache error: " + ex(e), logger.ERROR) raise def __del__(self): - self.npc.close() + if getattr(self, "npc", None) is not None: + self.npc.close() def add(self, name, parse_result): - name = name.encode('utf-8', 'replace') + name = name.encode('utf-8', 'ignore') self.npc[str(name)] = parse_result while len(self.npc.items()) > self.npc_cache_size: del self.npc.keys()[0] def get(self, name): - name = name.encode('utf-8', 'replace') + name = name.encode('utf-8', 'ignore') parse_result = self.npc.get(str(name), None) if parse_result: diff --git a/sickbeard/rssfeeds.py b/sickbeard/rssfeeds.py index ca39e975..d076816a 100644 --- a/sickbeard/rssfeeds.py +++ b/sickbeard/rssfeeds.py @@ -13,18 +13,18 @@ from lib.feedcache import cache class RSSFeeds: def __init__(self, db_name): try: - self.fs = shelve.open(ek.ek(os.path.join, sickbeard.CACHE_DIR, db_name + '.db')) + self.fs = shelve.open(ek.ek(os.path.join, sickbeard.CACHE_DIR, db_name)) self.fc = cache.Cache(self.fs) except Exception, e: logger.log(u"RSS error: " + ex(e), logger.ERROR) raise def __del__(self): - self.fs.close() + if getattr(self, "fs", None) is not None: + self.fs.close() def clearCache(self, age=None): self.fc.purge(age) - self.fs.close() def getFeed(self, url, post_data=None, request_headers=None): parsed = list(urlparse.urlparse(url)) @@ -34,7 +34,6 @@ class RSSFeeds: url += urllib.urlencode(post_data) feed = self.fc.fetch(url, False, False, request_headers) - self.fs.close() if not feed: logger.log(u"RSS Error loading URL: " + url, logger.ERROR) diff --git a/sickbeard/scene_exceptions.py b/sickbeard/scene_exceptions.py index 29129e57..ddd24126 100644 --- a/sickbeard/scene_exceptions.py +++ b/sickbeard/scene_exceptions.py @@ -27,6 +27,10 @@ from sickbeard import name_cache from sickbeard import logger from sickbeard import db +exception_dict = {} +anidb_exception_dict = {} +xem_exception_dict = {} + exceptionsCache = {} exceptionsSeasonCache = {} @@ -157,9 +161,7 @@ def retrieve_exceptions(): Looks up the exceptions on github, parses them into a dict, and inserts them into the scene_exceptions table in cache.db. Also clears the scene name cache. """ - global exceptionsCache, exceptionsSeasonCache - - exception_dict = {} + global exception_dict, anidb_exception_dict, xem_exception_dict # exceptions are stored on github pages for indexer in sickbeard.indexerApi().indexers: @@ -192,22 +194,24 @@ def retrieve_exceptions(): # alias_list = [re.sub(r'\\(.)', r'\1', x) for x in re.findall(r"'(.*?)(?