diff --git a/sickbeard/dailysearcher.py b/sickbeard/dailysearcher.py index aa9edf09..6e53346d 100644 --- a/sickbeard/dailysearcher.py +++ b/sickbeard/dailysearcher.py @@ -87,7 +87,7 @@ class DailySearcher(): def searchForNeededEpisodes(self): - logger.log(u"Searching all providers for any needed episodes") + logger.log(u"Searching ESS Cache for any needed new episodes") foundResults = {} diff --git a/sickbeard/name_cache.py b/sickbeard/name_cache.py index 345e3274..34b4f414 100644 --- a/sickbeard/name_cache.py +++ b/sickbeard/name_cache.py @@ -20,7 +20,7 @@ import sickbeard from sickbeard import db from sickbeard.helpers import sanitizeSceneName - +from sickbeard import logger def addNameToCache(name, indexer_id=0): """ @@ -59,6 +59,16 @@ def retrieveShowFromCache(name): if indexerid: return sickbeard.helpers.findCertainShow(sickbeard.showList, int(indexerid)) +def syncNameCache(): + cacheDB = db.DBConnection('cache.db') + + for curShow in sickbeard.showList: + for show_name in set(sickbeard.show_name_helpers.allPossibleShowNames(curShow)): + sqlResult = cacheDB.action("DELETE FROM scene_names WHERE name = ? and indexer_id = ?", [show_name, 0]) + if sqlResult: + logger.log(u"Removing invalid record for [" + show_name + "] from cache ...") + break + def clearCache(): """ Deletes all "unknown" entries from the cache (names with indexer_id of 0). diff --git a/sickbeard/rssupdater.py b/sickbeard/rssupdater.py index 1510bd7d..9a2b4eec 100644 --- a/sickbeard/rssupdater.py +++ b/sickbeard/rssupdater.py @@ -31,8 +31,11 @@ class RSSUpdater(): self.amActive = False def run(self): - providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()] + # remove names from cache that link back to active shows that we watch + sickbeard.name_cache.syncNameCache() + # update RSS cache + providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()] for provider in providers: logger.log(u"Updating RSS cache for provider [" + provider.name + "]") provider.cache.updateCache() \ No newline at end of file diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index b3c87c1b..02a3d555 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -249,18 +249,27 @@ class TVCache(): if cacheResult: in_cache = True indexerid = int(cacheResult) + elif cacheResult == 0: + return None if not indexerid: showResult = helpers.searchDBForShow(parse_result.series_name) if showResult: indexerid = int(showResult[0]) + if not indexerid: + for curShow in sickbeard.showList: + if show_name_helpers.isGoodResult(name, curShow, False): + indexerid = curShow.indexerid + break + showObj = None if indexerid: showObj = helpers.findCertainShow(sickbeard.showList, indexerid) if not showObj: logger.log(u"No match for show: [" + parse_result.series_name + "], not caching ...", logger.DEBUG) + sickbeard.name_cache.addNameToCache(parse_result.series_name, 0) return None season = episodes = None