diff --git a/CHANGES.md b/CHANGES.md index f790ccfb..effe8b8c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +### 0.8.3 (2015-04-25 08:48:00 UTC) + +* Fix clearing of the provider cache + + ### 0.8.2 (2015-04-19 06:45:00 UTC) * Fix IPTorrents provider search strings and URL for new site changes diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index b8d61093..ae91cac3 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -1439,3 +1439,10 @@ def check_port(host, port, timeout=1.0): except socket.error: if s: s.close() + +def clear_unused_providers(): + providers = [x.cache.providerID for x in sickbeard.providers.sortedProviderList() if x.isActive()] + + if providers: + myDB = db.DBConnection('cache.db') + myDB.action('DELETE FROM provider_cache WHERE provider NOT IN (%s)' % ','.join(['?'] * len(providers)), providers) \ No newline at end of file diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 0b04ad9c..7f34f2e5 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -439,11 +439,11 @@ class NewznabCache(tvcache.TVCache): if not data: return [] - self.setLastUpdate() - # clear cache self._clearCache() + self.setLastUpdate() + if self._checkAuth(data): items = data.entries cl = [] diff --git a/sickbeard/search.py b/sickbeard/search.py index aa3a813c..6c1234ab 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -462,7 +462,7 @@ def searchProviders(show, episodes, manualSearch=False): logger.log(u"Performing season pack search for " + show.name) try: - curProvider.cache.updateCache() + curProvider.cache._clearCache() searchResults = curProvider.findSearchResults(show, episodes, search_mode, manualSearch) except exceptions.AuthException, e: logger.log(u"Authentication error: " + ex(e), logger.ERROR) diff --git a/sickbeard/showUpdater.py b/sickbeard/showUpdater.py index d0fec516..48d636e6 100644 --- a/sickbeard/showUpdater.py +++ b/sickbeard/showUpdater.py @@ -44,6 +44,9 @@ class ShowUpdater(): if sickbeard.USE_FAILED_DOWNLOADS: failed_history.trimHistory() + # clear the data of unused providers + sickbeard.helpers.clear_unused_providers() + logger.log(u"Doing full update on all shows") # clean out cache directory, remove everything > 12 hours old diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index e1ebe1f1..29e2f1f9 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -284,6 +284,7 @@ class TVCache(): sqlResults = list(itertools.chain(*sqlResults)) if not sqlResults: + self.setLastSearch() return neededEps # for each cache entry diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index c8a05d5f..2fb4756c 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -4263,6 +4263,8 @@ class ConfigProviders(Config): sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList]) sickbeard.PROVIDER_ORDER = provider_list + helpers.clear_unused_providers() + sickbeard.save_config() if len(results) > 0: