From 3f35cba818f211f50b8e5c481872a5f8db2e5cad Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 24 Aug 2012 17:57:56 +0200 Subject: [PATCH] NZBsRus cleanup --- couchpotato/core/providers/nzb/nzbsrus/__init__.py | 1 + couchpotato/core/providers/nzb/nzbsrus/main.py | 21 +++++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/couchpotato/core/providers/nzb/nzbsrus/__init__.py b/couchpotato/core/providers/nzb/nzbsrus/__init__.py index 96322e1..70f3e3f 100644 --- a/couchpotato/core/providers/nzb/nzbsrus/__init__.py +++ b/couchpotato/core/providers/nzb/nzbsrus/__init__.py @@ -11,6 +11,7 @@ config = [{ 'subtab': 'providers', 'name': 'nzbsrus', 'label': 'Nzbsrus', + 'description': 'See NZBsRus', 'wizard': True, 'options': [ { diff --git a/couchpotato/core/providers/nzb/nzbsrus/main.py b/couchpotato/core/providers/nzb/nzbsrus/main.py index 2583691..20a51d5 100644 --- a/couchpotato/core/providers/nzb/nzbsrus/main.py +++ b/couchpotato/core/providers/nzb/nzbsrus/main.py @@ -9,7 +9,6 @@ import xml.etree.ElementTree as XMLTree log = CPLog(__name__) -# See the api http://www.nzbsrus.com/NzbsrusAPI.pdf class Nzbsrus(NZBProvider, RSS): urls = { @@ -19,11 +18,8 @@ class Nzbsrus(NZBProvider, RSS): } cat_ids = [ - ([90,45,51], ['720p', '1080p','brrip','bd50','dvdr']), - ([48,51], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr']), - - - + ([90, 45, 51], ['720p', '1080p', 'brrip', 'bd50', 'dvdr']), + ([48, 51], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr']), ] cat_backup_id = 240 @@ -37,17 +33,18 @@ class Nzbsrus(NZBProvider, RSS): cat_id_string = '&'.join(['c%s=1' % x for x in self.getCatId(quality.get('identifier'))]) arguments = tryUrlencode({ - 'searchtext': 'imdb:'+movie['library']['identifier'][2:], + 'searchtext': 'imdb:' + movie['library']['identifier'][2:], 'uid': self.conf('userid'), 'key': self.conf('api_key'), 'age': Env.setting('retention', section = 'nzb'), }) + # check for english_only if self.conf('english_only'): arguments += "&lang0=1&lang3=1&lang1=1" - url = "%s&%s&%s" % (self.urls['search'], arguments ,cat_id_string) + url = "%s&%s&%s" % (self.urls['search'], arguments , cat_id_string) cache_key = 'nzbsrus_1.%s.%s' % (movie['library'].get('identifier'), cat_id_string) single_cat = True @@ -69,9 +66,8 @@ class Nzbsrus(NZBProvider, RSS): id = self.getTextElement(nzb, "id") size = int(round(int(self.getTextElement(nzb, "size")) / 1048576)) - age = int(round(( time.time() - int(self.getTextElement(nzb, "postdate")) ) / 86400 )) + age = int(round((time.time() - int(self.getTextElement(nzb, "postdate"))) / 86400)) - new = { 'id': id, 'type': 'nzb', @@ -88,7 +84,7 @@ class Nzbsrus(NZBProvider, RSS): is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality, - imdb_results = True, single_category = single_cat, single = True) + imdb_results = True, single = True) if is_correct_movie: new['score'] = fireEvent('score.calculate', new, movie, single = True) @@ -106,6 +102,3 @@ class Nzbsrus(NZBProvider, RSS): def getApiExt(self): return '/%s/' % (self.conf('userid')) - - def isEnabled(self): - return NZBProvider.isEnabled(self) and self.conf('userid') and self.conf('api_key')