1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Merge pull request #917 from Hellowlol/apifasterplx

Respect cache.
This commit is contained in:
echel0n 2014-11-18 19:45:00 -08:00
commit e57fa4d585
2 changed files with 14 additions and 13 deletions

View File

@ -101,15 +101,12 @@ class ShowContainer(dict):
#keep only the 100th latest results #keep only the 100th latest results
if time.time() - self._lastgc > 20: if time.time() - self._lastgc > 20:
tbd = self._stack[:-100] for o in self._stack[:-100]:
i = 0
for o in tbd:
del self[o] del self[o]
del self._stack[i]
i += 1 self._stack = self._stack[-100:]
_lastgc = time.time() self._lastgc = time.time()
del tbd
super(ShowContainer, self).__setitem__(key, value) super(ShowContainer, self).__setitem__(key, value)

View File

@ -667,9 +667,9 @@ def get_all_episodes_from_absolute_number(show, absolute_numbers, indexer_id=Non
def sanitizeSceneName(name, ezrss=False): def sanitizeSceneName(name, ezrss=False):
""" """
Takes a show name and returns the "scenified" version of it. Takes a show name and returns the "scenified" version of it.
ezrss: If true the scenified version will follow EZRSS's cracksmoker rules as best as possible ezrss: If true the scenified version will follow EZRSS's cracksmoker rules as best as possible
Returns: A string containing the scene version of the show name given. Returns: A string containing the scene version of the show name given.
""" """
@ -900,7 +900,7 @@ def md5_for_file(filename, block_size=2 ** 16):
def get_lan_ip(): def get_lan_ip():
""" """
Simple function to get LAN localhost_ip Simple function to get LAN localhost_ip
http://stackoverflow.com/questions/11735821/python-get-localhost-ip http://stackoverflow.com/questions/11735821/python-get-localhost-ip
""" """
@ -970,7 +970,7 @@ By Pedro Jose Pereira Vieito <pvieito@gmail.com> (@pvieito)
* The keys should be unique for each device * The keys should be unique for each device
To add a new encryption_version: To add a new encryption_version:
1) Code your new encryption_version 1) Code your new encryption_version
2) Update the last encryption_version available in webserve.py 2) Update the last encryption_version available in webserve.py
3) Remember to maintain old encryption versions and key generators for retrocompatibility 3) Remember to maintain old encryption versions and key generators for retrocompatibility
""" """
@ -1164,8 +1164,12 @@ def mapIndexersToShow(showObj):
# for each mapped entry # for each mapped entry
for curResult in sqlResults: for curResult in sqlResults:
logger.log(u"Found indexer mapping in cache for show: " + showObj.name, logger.DEBUG) nlist = [i for i in curResult if i is not None]
mapped[int(curResult['mindexer'])] = int(curResult['mindexer_id']) # Check if its mapped with both tvdb and tvrage.
if len(nlist) >= 4:
logger.log(u"Found indexer mapping in cache for show: " + showObj.name, logger.DEBUG)
mapped[int(curResult['mindexer'])] = int(curResult['mindexer_id'])
return mapped
else: else:
sql_l = [] sql_l = []
for indexer in sickbeard.indexerApi().indexers: for indexer in sickbeard.indexerApi().indexers: