mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Improved caching results code, helps with daily searches.
This commit is contained in:
parent
e20adcfab8
commit
1fcfa4c70a
4 changed files with 25 additions and 3 deletions
|
@ -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 = {}
|
||||
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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()
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue