From bf510f709cba3c93cf134d1a60ce1529d23975ac Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 17 Mar 2015 00:38:38 +0800 Subject: [PATCH] Fix updating of scene exception name cache after adding exceptions on Editshow page --- CHANGES.md | 1 + sickbeard/name_cache.py | 8 ++++++-- sickbeard/webserve.py | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 71696100..b05a4232 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -42,6 +42,7 @@ * Change to reduce the time taken to "Update shows" with show data * Change to stop updating the IMDb info during the scheduled daily update for every show * Change to update the IMDb info for a show after snatching an episode for it +* Fix updating of scene exception name cache after adding exceptions on Editshow page [develop changelog] * Fix traceback error when using the menu item Manage/Update Kodi diff --git a/sickbeard/name_cache.py b/sickbeard/name_cache.py index a7ff7369..7c80a222 100644 --- a/sickbeard/name_cache.py +++ b/sickbeard/name_cache.py @@ -84,13 +84,14 @@ def buildNameCache(show=None): global nameCache with nameCacheLock: - # clear internal name cache - clearCache() # update scene exception names sickbeard.scene_exceptions.retrieve_exceptions() if not show: + # clear internal name cache + clearCache() + logger.log(u"Building internal name cache for all shows", logger.MESSAGE) cacheDB = db.DBConnection('cache.db') @@ -114,6 +115,9 @@ def buildNameCache(show=None): nameCache[name] = int(show.indexerid) else: + # remove old show cache entries + nameCache = dict((k, v) for k, v in nameCache.items() if v != show.indexerid) + logger.log(u"Building internal name cache for " + show.name, logger.MESSAGE) for curSeason in [-1] + sickbeard.scene_exceptions.get_scene_seasons(show.indexerid): diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 77ac0473..1e42f767 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -44,6 +44,7 @@ from sickbeard.scene_exceptions import get_scene_exceptions from sickbeard.scene_numbering import get_scene_numbering, set_scene_numbering, get_scene_numbering_for_show, \ get_xem_numbering_for_show, get_scene_absolute_numbering_for_show, get_xem_absolute_numbering_for_show, \ get_scene_absolute_numbering +from sickbeard.name_cache import buildNameCache from sickbeard.browser import foldersAtPath from sickbeard.blackandwhitelist import BlackAndWhiteList, short_group_names from tornado import gen @@ -1307,6 +1308,7 @@ class Home(MainHandler): if do_update_exceptions: try: scene_exceptions.update_scene_exceptions(showObj.indexerid, exceptions_list) # @UndefinedVdexerid) + buildNameCache(showObj) time.sleep(cpu_presets[sickbeard.CPU_PRESET]) except exceptions.CantUpdateException, e: errors.append('Unable to force an update on scene exceptions of the show.')