From f1c9ed3ceab4d186acba3fdb8a9e77599d3e4bd4 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 4 Jun 2011 21:37:19 +0200 Subject: [PATCH] More specific caching keys --- couchpotato/core/providers/nzb/newznab/main.py | 2 +- couchpotato/core/providers/nzb/nzbmatrix/main.py | 2 +- couchpotato/core/providers/nzb/nzbs/main.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/providers/nzb/newznab/main.py b/couchpotato/core/providers/nzb/newznab/main.py index dccd047c..6f86fac7 100644 --- a/couchpotato/core/providers/nzb/newznab/main.py +++ b/couchpotato/core/providers/nzb/newznab/main.py @@ -54,7 +54,7 @@ class Newznab(NZBProvider, RSS): }) url = "%s&%s" % (self.getUrl(self.urls['search']), arguments) - cache_key = '%s-%s' % (movie['library']['identifier'], cat_id[0]) + cache_key = 'newznab.%s.%s' % (movie['library']['identifier'], cat_id[0]) single_cat = (len(cat_id) == 1 and cat_id[0] != self.cat_backup_id) try: diff --git a/couchpotato/core/providers/nzb/nzbmatrix/main.py b/couchpotato/core/providers/nzb/nzbmatrix/main.py index ecabe220..952f4fc2 100644 --- a/couchpotato/core/providers/nzb/nzbmatrix/main.py +++ b/couchpotato/core/providers/nzb/nzbmatrix/main.py @@ -53,7 +53,7 @@ class NZBMatrix(NZBProvider, RSS): url = "%s?%s" % (self.urls['search'], arguments) log.info('Searching: %s' % url) - cache_key = '%s-%s' % (movie['library'].get('identifier'), cat_ids) + cache_key = 'nzbmatrix.%s.%s' % (movie['library'].get('identifier'), cat_ids) single_cat = True try: diff --git a/couchpotato/core/providers/nzb/nzbs/main.py b/couchpotato/core/providers/nzb/nzbs/main.py index 09227eb8..8ea5408d 100644 --- a/couchpotato/core/providers/nzb/nzbs/main.py +++ b/couchpotato/core/providers/nzb/nzbs/main.py @@ -50,7 +50,7 @@ class Nzbs(NZBProvider, RSS): }) url = "%s?%s" % (self.urls['api'], arguments) - cache_key = '%s-%s' % (movie['library'].get('identifier'), str(cat_id)) + cache_key = 'nzbs.%s.%s' % (movie['library'].get('identifier'), str(cat_id)) try: data = self.getCache(cache_key) @@ -72,8 +72,9 @@ class Nzbs(NZBProvider, RSS): for nzb in nzbs: + id = int(self.getTextElement(nzb, "link").partition('nzbid=')[2]) new = { - 'id': int(self.getTextElement(nzb, "link").partition('nzbid=')[2]), + 'id': id, 'type': 'nzb', 'name': self.getTextElement(nzb, "title"), 'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, "pubDate")).timetuple()))),