diff --git a/CHANGES.md b/CHANGES.md index b4f2f60c..260bfdcd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,7 @@ * Fix adding show from TVRage API -### 0.4.0 (2014-11-23 03:27:00 UTC) +### 0.4.0 (2014-11-23 08:44:00 UTC) * Change footer stats to not add newlines when copy/pasting from them * Remove redundant references from Config/Help & Info @@ -59,6 +59,7 @@ * Fix typo on General Config/Misc * Fix Add Trending Shows "Not In library" now filters tvrage added shows * Add a hover over text "In library" on Add Trending Shows to display tv database show was added from +* Fix reduces time API endpoint Shows takes to return results ### 0.3.1 (2014-11-19 16:40:00 UTC) diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index 747dccf7..b5347bdf 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -98,15 +98,12 @@ class ShowContainer(dict): #keep only the 100th latest results if time.time() - self._lastgc > 20: - tbd = self._stack[:-100] - i = 0 - for o in tbd: + for o in self._stack[:-100]: del self[o] - del self._stack[i] - i += 1 + + self._stack = self._stack[-100:] - _lastgc = time.time() - del tbd + self._lastgc = time.time() super(ShowContainer, self).__setitem__(key, value) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 0936e932..ec84ed63 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -667,9 +667,9 @@ def get_all_episodes_from_absolute_number(show, absolute_numbers, indexer_id=Non def sanitizeSceneName(name, ezrss=False): """ 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 - + 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(): """ - Simple function to get LAN localhost_ip + Simple function to get LAN localhost_ip http://stackoverflow.com/questions/11735821/python-get-localhost-ip """ @@ -970,7 +970,7 @@ By Pedro Jose Pereira Vieito (@pvieito) * The keys should be unique for each device 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 3) Remember to maintain old encryption versions and key generators for retrocompatibility """ @@ -1164,8 +1164,13 @@ def mapIndexersToShow(showObj): # for each mapped entry for curResult in sqlResults: - logger.log(u"Found indexer mapping in cache for show: " + showObj.name, logger.DEBUG) - mapped[int(curResult['mindexer'])] = int(curResult['mindexer_id']) + nlist = [i for i in curResult if None is not i] + # Check if its mapped with both tvdb and tvrage. + if 4 <= len(nlist): + logger.log(u"Found indexer mapping in cache for show: " + showObj.name, logger.DEBUG) + mapped[int(curResult['mindexer'])] = int(curResult['mindexer_id']) + break + else: sql_l = [] for indexer in sickbeard.indexerApi().indexers: