From ed8108a9d84c33263d42d40195ac04ebdf34d9fc Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 8 Jul 2013 11:30:55 +0200 Subject: [PATCH 1/2] Remove NZBsRus --- couchpotato/core/providers/nzb/nzbsrus/__init__.py | 49 ----------------- couchpotato/core/providers/nzb/nzbsrus/main.py | 62 ---------------------- 2 files changed, 111 deletions(-) delete mode 100644 couchpotato/core/providers/nzb/nzbsrus/__init__.py delete mode 100644 couchpotato/core/providers/nzb/nzbsrus/main.py diff --git a/couchpotato/core/providers/nzb/nzbsrus/__init__.py b/couchpotato/core/providers/nzb/nzbsrus/__init__.py deleted file mode 100644 index 863e6a3..0000000 --- a/couchpotato/core/providers/nzb/nzbsrus/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -from .main import Nzbsrus - -def start(): - return Nzbsrus() - -config = [{ - 'name': 'nzbsrus', - 'groups': [ - { - 'tab': 'searcher', - 'subtab': 'providers', - 'list': 'nzb_providers', - 'name': 'nzbsrus', - 'label': 'Nzbsrus', - 'description': 'See NZBsRus. You need a VIP account!', - 'wizard': True, - 'options': [ - { - 'name': 'enabled', - 'type': 'enabler', - }, - { - 'name': 'userid', - 'label': 'User ID', - }, - { - 'name': 'api_key', - 'default': '', - 'label': 'Api Key', - }, - { - 'name': 'english_only', - 'default': 1, - 'type': 'bool', - 'label': 'English only', - 'description': 'Only search for English spoken movies on Nzbsrus', - }, - { - 'name': 'extra_score', - 'advanced': True, - 'label': 'Extra Score', - 'type': 'int', - 'default': 0, - 'description': 'Starting score for each release found via this provider.', - } - ], - }, - ], -}] diff --git a/couchpotato/core/providers/nzb/nzbsrus/main.py b/couchpotato/core/providers/nzb/nzbsrus/main.py deleted file mode 100644 index d52212a..0000000 --- a/couchpotato/core/providers/nzb/nzbsrus/main.py +++ /dev/null @@ -1,62 +0,0 @@ -from couchpotato.core.helpers.encoding import tryUrlencode -from couchpotato.core.helpers.rss import RSS -from couchpotato.core.logger import CPLog -from couchpotato.core.providers.nzb.base import NZBProvider -from couchpotato.environment import Env -import time - -log = CPLog(__name__) - -class Nzbsrus(NZBProvider, RSS): - - urls = { - 'download': 'https://www.nzbsrus.com/nzbdownload_rss.php/%s', - 'detail': 'https://www.nzbsrus.com/nzbdetails.php?id=%s', - 'search': 'https://www.nzbsrus.com/api.php?extended=1&xml=1&listname={date,grabs}', - } - - cat_ids = [ - ([90, 45, 51], ['720p', '1080p', 'brrip', 'bd50', 'dvdr']), - ([48, 51], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr']), - ] - cat_backup_id = 240 - - def _search(self, movie, quality, results): - - cat_id_string = '&'.join(['c%s=1' % x for x in self.getCatId(quality.get('identifier'))]) - arguments = tryUrlencode({ - '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) - nzbs = self.getRSSData(url, item_path = 'results/result', cache_timeout = 1800, headers = {'User-Agent': Env.getIdentifier()}) - - for nzb in nzbs: - - title = self.getTextElement(nzb, 'name') - if 'error' in title.lower(): continue - - nzb_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)) - - results.append({ - 'id': nzb_id, - 'name': title, - 'age': age, - 'size': size, - 'url': self.urls['download'] % nzb_id + self.getApiExt() + self.getTextElement(nzb, 'key'), - 'detail_url': self.urls['detail'] % nzb_id, - 'description': self.getTextElement(nzb, 'addtext'), - }) - - def getApiExt(self): - return '/%s/' % (self.conf('userid')) From e20bb1364998fe045961306934d5e8d4abee34e7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 8 Jul 2013 11:31:13 +0200 Subject: [PATCH 2/2] Delete NZBx --- couchpotato/core/providers/nzb/nzbx/__init__.py | 33 --------------------- couchpotato/core/providers/nzb/nzbx/main.py | 38 ------------------------- 2 files changed, 71 deletions(-) delete mode 100644 couchpotato/core/providers/nzb/nzbx/__init__.py delete mode 100644 couchpotato/core/providers/nzb/nzbx/main.py diff --git a/couchpotato/core/providers/nzb/nzbx/__init__.py b/couchpotato/core/providers/nzb/nzbx/__init__.py deleted file mode 100644 index 9cf8063..0000000 --- a/couchpotato/core/providers/nzb/nzbx/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -from .main import Nzbx - -def start(): - return Nzbx() - -config = [{ - 'name': 'nzbx', - 'groups': [ - { - 'tab': 'searcher', - 'subtab': 'providers', - 'list': 'nzb_providers', - 'name': 'nzbX', - 'description': 'Free provider. See nzbX', - 'wizard': True, - 'options': [ - { - 'name': 'enabled', - 'type': 'enabler', - 'default': True, - }, - { - 'name': 'extra_score', - 'advanced': True, - 'label': 'Extra Score', - 'type': 'int', - 'default': 0, - 'description': 'Starting score for each release found via this provider.', - } - ], - }, - ], -}] diff --git a/couchpotato/core/providers/nzb/nzbx/main.py b/couchpotato/core/providers/nzb/nzbx/main.py deleted file mode 100644 index ec7fbfe..0000000 --- a/couchpotato/core/providers/nzb/nzbx/main.py +++ /dev/null @@ -1,38 +0,0 @@ -from couchpotato.core.helpers.encoding import tryUrlencode -from couchpotato.core.helpers.variable import tryInt -from couchpotato.core.logger import CPLog -from couchpotato.core.providers.nzb.base import NZBProvider -from couchpotato.environment import Env - -log = CPLog(__name__) - - -class Nzbx(NZBProvider): - - urls = { - 'search': 'https://nzbx.co/api/search?%s', - 'details': 'https://nzbx.co/api/details?guid=%s', - } - - http_time_between_calls = 1 # Seconds - - def _search(self, movie, quality, results): - - # Get nbzs - arguments = tryUrlencode({ - 'q': movie['library']['identifier'].replace('tt', ''), - 'sf': quality.get('size_min'), - }) - nzbs = self.getJsonData(self.urls['search'] % arguments, headers = {'User-Agent': Env.getIdentifier()}) - - for nzb in nzbs: - - results.append({ - 'id': nzb['guid'], - 'url': nzb['nzb'], - 'detail_url': self.urls['details'] % nzb['guid'], - 'name': nzb['name'], - 'age': self.calculateAge(int(nzb['postdate'])), - 'size': tryInt(nzb['size']) / 1024 / 1024, - 'score': 5 if nzb['votes']['upvotes'] > nzb['votes']['downvotes'] else 0 - })