Private GIT

Skip to content
Snippets Groups Projects
Commit 00f49154 authored by miigotu's avatar miigotu
Browse files

Merge pull request #2001 from miigotu/namecache-fix

Move name_cache lock to fix error of list modified during iteration
parents de2c451e e8ffd7ee
Branches
Tags
No related merge requests found
......@@ -30,6 +30,7 @@ def addNameToCache(name, indexer_id=0):
name: The show name to cache
indexer_id: the TVDB and TVRAGE id that this show should be cached with (can be None/0 for unknown)
"""
global nameCache
cacheDB = db.DBConnection('cache.db')
......@@ -82,7 +83,7 @@ def saveNameCacheToDb():
def buildNameCache(show=None):
global nameCache
with nameCacheLock:
sickbeard.scene_exceptions.retrieve_exceptions()
if not show:
......@@ -90,12 +91,10 @@ def buildNameCache(show=None):
for show in sickbeard.showList:
buildNameCache(show)
else:
with nameCacheLock:
logger.log(u"Building internal name cache for " + show.name, logger.INFO)
clearCache(show.indexerid)
for curSeason in [-1] + sickbeard.scene_exceptions.get_scene_seasons(show.indexerid):
for name in list(set(sickbeard.scene_exceptions.get_scene_exceptions(show.indexerid, season=curSeason) + [
show.name])):
for name in list(set(sickbeard.scene_exceptions.get_scene_exceptions(show.indexerid, season=curSeason) + [show.name])):
name = sickbeard.helpers.full_sanitizeSceneName(name)
if name in nameCache:
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment