mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Added back in name cache but force it to only store entries if they have a valid Indexer ID otherwise disgard them.
This commit is contained in:
parent
9384881241
commit
3f8729ef83
@ -28,14 +28,11 @@ def addNameToCache(name, indexer_id):
|
||||
indexer_id: the TVDB and TVRAGE id that this show should be cached with (can be None/0 for unknown)
|
||||
"""
|
||||
|
||||
# standardize the name we're using to account for small differences in providers
|
||||
name = sanitizeSceneName(name)
|
||||
|
||||
if not indexer_id:
|
||||
indexer_id = 0
|
||||
|
||||
cacheDB = db.DBConnection('cache.db')
|
||||
cacheDB.action("INSERT INTO scene_names (indexer_id, name) VALUES (?, ?)", [indexer_id, name])
|
||||
if indexer_id:
|
||||
# standardize the name we're using to account for small differences in providers
|
||||
name = sanitizeSceneName(name)
|
||||
cacheDB = db.DBConnection('cache.db')
|
||||
cacheDB.action("INSERT INTO scene_names (indexer_id, name) VALUES (?, ?)", [indexer_id, name])
|
||||
|
||||
|
||||
def retrieveNameFromCache(name):
|
||||
@ -53,10 +50,8 @@ def retrieveNameFromCache(name):
|
||||
cacheDB = db.DBConnection('cache.db')
|
||||
cache_results = cacheDB.select("SELECT * FROM scene_names WHERE name = ?", [name])
|
||||
|
||||
if not cache_results:
|
||||
return None
|
||||
|
||||
return int(cache_results[0]["indexer_id"])
|
||||
if cache_results:
|
||||
return int(cache_results[0]["indexer_id"])
|
||||
|
||||
|
||||
def clearCache():
|
||||
|
@ -242,6 +242,10 @@ class TVCache():
|
||||
|
||||
# if we didn't find a Indexer ID return None
|
||||
if indexer_id:
|
||||
# add to name cache if we didn't get it from the cache
|
||||
if not from_cache:
|
||||
name_cache.addNameToCache(parse_result.series_name, indexer_id)
|
||||
|
||||
# if the show isn't in out database then return None
|
||||
try:
|
||||
showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
||||
|
Loading…
Reference in New Issue
Block a user