Commit 1ad42feb authored by echel0n's avatar echel0n
Browse files

Clears name cache with indexerid and show name

parent e26ad3eb
# Changelog # Changelog
- * 8000c60 - 2018-10-28: Converted Timezone Updater to class - * c6c846f - 2018-10-28: Clears name cache with indexerid and show name
- * e26ad3e - 2018-10-28: Converted Timezone Updater to class
- * 7e3baa8 - 2018-10-28: Disabled warning for when no nzb/torrent provider is picked if no nzb/torrent client enabled. Disabled search column for display show view if no nzb/torrent is picked. - * 7e3baa8 - 2018-10-28: Disabled warning for when no nzb/torrent provider is picked if no nzb/torrent client enabled. Disabled search column for display show view if no nzb/torrent is picked.
- * 9969a0b - 2018-10-28: Added function to strip accents to encoding functions - * 9969a0b - 2018-10-28: Added function to strip accents to encoding functions
- * bf93454 - 2018-10-27: Release v9.4.1 - * bf93454 - 2018-10-27: Release v9.4.1
......
...@@ -83,16 +83,18 @@ class NameCache(object): ...@@ -83,16 +83,18 @@ class NameCache(object):
if name in self.cache: if name in self.cache:
return int(self.cache[name]) return int(self.cache[name])
def clear(self, indexerid): def clear(self, indexerid=None, name=None):
""" """
Deletes all entries from the cache matching the indexerid. Deletes all entries from the cache matching the indexerid or name.
""" """
[sickrage.app.cache_db.delete(x) for x in if any([indexerid, name]):
sickrage.app.cache_db.all('scene_names') for x in sickrage.app.cache_db.all('scene_names'):
if x['indexer_id'] == indexerid] if x['indexer_id'] == indexerid or x['name'] == name:
sickrage.app.cache_db.delete(x)
for item in [self.cache[key] for key, value in self.cache.items() if value == indexerid]: for key, value in self.cache.items():
del item if value == indexerid or key == name:
del self.cache[key]
def load(self): def load(self):
self.cache = dict([(x['name'], x['indexer_id']) for x in sickrage.app.cache_db.all('scene_names')]) self.cache = dict([(x['name'], x['indexer_id']) for x in sickrage.app.cache_db.all('scene_names')])
...@@ -135,4 +137,5 @@ class NameCache(object): ...@@ -135,4 +137,5 @@ class NameCache(object):
show_names.append(strip_accents(name).replace("'", " ")) show_names.append(strip_accents(name).replace("'", " "))
for show_name in set(show_names): for show_name in set(show_names):
self.clear(show_name)
self.put(show_name, show.indexerid) self.put(show_name, show.indexerid)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment