From f0c1f57673779271d145854a73c5e9e8dba3b12f Mon Sep 17 00:00:00 2001 From: bwq Date: Tue, 11 Oct 2011 21:40:50 +0200 Subject: [PATCH 01/10] Added the #alt.binaries.hdtv.x264 provider. Added error handling for faulty/empty nzbs and file handling for rarred nzbs. --- .gitignore | 3 +- couchpotato/core/downloaders/blackhole/main.py | 10 +++ couchpotato/core/providers/nzb/x264/__init__.py | 20 ++++++ couchpotato/core/providers/nzb/x264/main.py | 89 +++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 couchpotato/core/providers/nzb/x264/__init__.py create mode 100644 couchpotato/core/providers/nzb/x264/main.py diff --git a/.gitignore b/.gitignore index 217a73c..8a4b7fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /settings.conf /logs/*.log /_source/ -/_data/ \ No newline at end of file +/_data/ +*.pyc diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index f4357e7..d940e94 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -29,6 +29,16 @@ class Blackhole(Downloader): try: file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) + # error handling for nzbs that aren't available + if "no nzb" in file: + log.error('No nzb available!') + return False + + # some providers provide nzbs that are rarred, save these with the proper extension + if "DOCTYPE nzb" not in file: + if data.get('type') == 'nzb': + fullPath = os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , 'rar')) + with open(fullPath, 'wb') as f: f.write(file) except: diff --git a/couchpotato/core/providers/nzb/x264/__init__.py b/couchpotato/core/providers/nzb/x264/__init__.py new file mode 100644 index 0000000..cf65b0a --- /dev/null +++ b/couchpotato/core/providers/nzb/x264/__init__.py @@ -0,0 +1,20 @@ +from .main import X264 + +def start(): + return X264() + +config = [{ + 'name': 'x264', + 'groups': [ + { + 'tab': 'providers', + 'name': '#alt.binaries.hdtv.x264', + 'options': [ + { + 'name': 'enabled', + 'type': 'enabler', + }, + ], + }, + ], +}] diff --git a/couchpotato/core/providers/nzb/x264/main.py b/couchpotato/core/providers/nzb/x264/main.py new file mode 100644 index 0000000..0382acd --- /dev/null +++ b/couchpotato/core/providers/nzb/x264/main.py @@ -0,0 +1,89 @@ +from couchpotato.core.event import fireEvent +from couchpotato.core.helpers.rss import RSS +from couchpotato.core.logger import CPLog +from couchpotato.core.providers.nzb.base import NZBProvider +from dateutil.parser import parse +from imdb.parser.http.bsouplxml._bsoup import SoupStrainer, BeautifulSoup +import urllib +import urllib2 +from urllib import urlencode +from urllib import quote_plus +import time +import re + +log = CPLog(__name__) + + +class X264(NZBProvider, RSS): + + urls = { + 'download': 'http://85.214.105.230/get_nzb.php?id=%s§ion=hd', + 'search': 'http://85.214.105.230/x264/requests.php?release=%s&status=FILLED&age=700&sort=ID', + 'regex': '(?P.*?)(?P.*?)</td>', + } + + def search(self, movie, quality): + + results = [] + if self.isDisabled() or not self.isAvailable(self.urls['search']): + return results + + url = self.urls['search'] % quote_plus(movie['library']['titles'][0]['title'] + ' ' + quality.get('identifier')) + log.info('Searching: %s' % url) + + try: + opener = urllib2.build_opener() + urllib2.install_opener(opener) + f = opener.open(url) + data = f.read() + f.close() + + except (IOError, URLError): + log.error('Failed to open %s.' % url) + return results + + match = re.compile(self.urls['regex'], re.DOTALL ).finditer(data) + + for nzb in match: + new = { + 'id': nzb.group('id'), + 'name': nzb.group('title'), + 'type': 'nzb', + 'provider': self.getName(), + 'age': self.calculateAge(time.time()), + 'size': 9999, + 'url': self.urls['download'] % (nzb.group('id')), + 'download': self.download, + 'detail_url': '', + 'description': '', + 'check_nzb': False, + } + + new['score'] = fireEvent('score.calculate', new, movie, single = True) + is_correct_movie = fireEvent('searcher.correct_movie', + nzb = new, movie = movie, quality = quality, + imdb_results = False, single_category = False, single = True) + if is_correct_movie: + results.append(new) + self.found(new) + return results + + def download(self, url = '', nzb_id = ''): + try: + log.info('Download nzb from #alt.binaries.hdtv.x264, report id: %s ' % nzb_id) + + return self.urlopen(self.urls['download'] % nzb_id) + except Exception, e: + log.error('Failed downloading from #alt.binaries.hdtv.x264, check credit: %s' % e) + return False + + def getFormatId(self, format): + for id, quality in self.format_ids.iteritems(): + for q in quality: + if q == format: + return id + + return self.cat_backup_id + + def isEnabled(self): + return NZBProvider.isEnabled(self) and self.conf('enabled') From bfcc0ae6eae0c43051bfd57f2e8f7833a682e9dc Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Tue, 11 Oct 2011 21:58:40 +0200 Subject: [PATCH 02/10] Removed some stuff that has no place in there. --- couchpotato/core/providers/nzb/x264/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/providers/nzb/x264/main.py b/couchpotato/core/providers/nzb/x264/main.py index 0382acd..2cbd976 100644 --- a/couchpotato/core/providers/nzb/x264/main.py +++ b/couchpotato/core/providers/nzb/x264/main.py @@ -70,11 +70,11 @@ class X264(NZBProvider, RSS): def download(self, url = '', nzb_id = ''): try: - log.info('Download nzb from #alt.binaries.hdtv.x264, report id: %s ' % nzb_id) + log.info('Downloading nzb from #alt.binaries.hdtv.x264, request id: %s ' % nzb_id) return self.urlopen(self.urls['download'] % nzb_id) except Exception, e: - log.error('Failed downloading from #alt.binaries.hdtv.x264, check credit: %s' % e) + log.error('Failed downloading from #alt.binaries.hdtv.x264: %s' % e) return False def getFormatId(self, format): From 3f0d71a8fe5dce6a6bef24ae892ef9ee9aeedd7a Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Tue, 11 Oct 2011 22:43:00 +0200 Subject: [PATCH 03/10] Moving this elsewhere. --- couchpotato/core/downloaders/blackhole/main.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index d940e94..fb22f20 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -28,17 +28,7 @@ class Blackhole(Downloader): try: file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) - - # error handling for nzbs that aren't available - if "no nzb" in file: - log.error('No nzb available!') - return False - - # some providers provide nzbs that are rarred, save these with the proper extension - if "DOCTYPE nzb" not in file: - if data.get('type') == 'nzb': - fullPath = os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , 'rar')) - + with open(fullPath, 'wb') as f: f.write(file) except: From 20277ee2441470a6d7a9c82404acd7e198b93531 Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Tue, 11 Oct 2011 23:17:30 +0200 Subject: [PATCH 04/10] Blackhole support for rarred and empty (faulty) nzbs. --- .gitignore | 1 - couchpotato/core/downloaders/base.py | 3 +++ couchpotato/core/downloaders/blackhole/main.py | 28 +++++++++++++++++--------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 8a4b7fd..3dec717 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ /logs/*.log /_source/ /_data/ -*.pyc diff --git a/couchpotato/core/downloaders/base.py b/couchpotato/core/downloaders/base.py index f72c0b3..b9941c8 100644 --- a/couchpotato/core/downloaders/base.py +++ b/couchpotato/core/downloaders/base.py @@ -16,6 +16,9 @@ class Downloader(Plugin): def download(self, data = {}): pass + def createFileExtension(self, data = {}, content): + pass + def cpTag(self, movie): if Env.setting('enabled', 'renamer'): return '.cp(' + movie['library'].get('identifier') + ')' if movie['library'].get('identifier') else '' diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index fb22f20..32afc04 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -10,6 +10,12 @@ class Blackhole(Downloader): type = ['nzb', 'torrent'] + def createFileExtension(self, data = {}, content): + if "DOCTYPE nzb" not in content: + if data.get('type') == 'nzb': + return 'rar' + return data.get('type') + def download(self, data = {}, movie = {}): if self.isDisabled() or not self.isCorrectType(data.get('type') or not self.conf('use_for') in ['both', data.get('type')]): @@ -20,15 +26,21 @@ class Blackhole(Downloader): if not directory or not os.path.isdir(directory): log.error('No directory set for blackhole %s download.' % data.get('type')) else: - fullPath = os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , data.get('type'))) - - try: - if not os.path.isfile(fullPath): - log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) - try: file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) + if "no nzb" in file: + log.error('No nzb available!') + + fileExtension = createFileExtension(data, file) + fullPath = os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , fileExtension) + try: + if not os.path.isfile(fullPath): + log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) + except: + log.error('Failed to download to blackhole %s' % traceback.format_exc()) + pass + with open(fullPath, 'wb') as f: f.write(file) except: @@ -39,8 +51,4 @@ class Blackhole(Downloader): else: log.info('File %s already exists.' % fullPath) return True - except: - log.error('Failed to download to blackhole %s' % traceback.format_exc()) - pass - return False From 7e23de42780c7474643da2f184141ed9f41470e2 Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Tue, 11 Oct 2011 23:35:35 +0200 Subject: [PATCH 05/10] blackhole --- couchpotato/core/downloaders/base.py | 8 ++++++-- couchpotato/core/downloaders/blackhole/main.py | 20 ++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/couchpotato/core/downloaders/base.py b/couchpotato/core/downloaders/base.py index b9941c8..8156af9 100644 --- a/couchpotato/core/downloaders/base.py +++ b/couchpotato/core/downloaders/base.py @@ -2,6 +2,7 @@ from couchpotato.core.event import addEvent from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.environment import Env +import os log = CPLog(__name__) @@ -16,8 +17,11 @@ class Downloader(Plugin): def download(self, data = {}): pass - def createFileExtension(self, data = {}, content): - pass + def createFileName(self, directory, data = {}, content, movie): + if "DOCTYPE nzb" not in content: + if data.get('type') == 'nzb': + return os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , 'rar') + return os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , data.get('type')) def cpTag(self, movie): if Env.setting('enabled', 'renamer'): diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index 32afc04..7afb905 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -10,12 +10,6 @@ class Blackhole(Downloader): type = ['nzb', 'torrent'] - def createFileExtension(self, data = {}, content): - if "DOCTYPE nzb" not in content: - if data.get('type') == 'nzb': - return 'rar' - return data.get('type') - def download(self, data = {}, movie = {}): if self.isDisabled() or not self.isCorrectType(data.get('type') or not self.conf('use_for') in ['both', data.get('type')]): @@ -31,12 +25,15 @@ class Blackhole(Downloader): if "no nzb" in file: log.error('No nzb available!') - fileExtension = createFileExtension(data, file) - fullPath = os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , fileExtension) + fullPath = self.createFileName(directory, data, file, movie) try: if not os.path.isfile(fullPath): log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) + else: + log.info('File %s already exists.' % fullPath) + return True + except: log.error('Failed to download to blackhole %s' % traceback.format_exc()) pass @@ -44,11 +41,6 @@ class Blackhole(Downloader): with open(fullPath, 'wb') as f: f.write(file) except: - log.debug('Failed download file: %s' % data.get('name')) + log.debug('Failed to download file: %s' % data.get('name')) return False - - return True - else: - log.info('File %s already exists.' % fullPath) - return True return False From 55514807033cafa109f05239172bdc152cfd6c40 Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Wed, 12 Oct 2011 01:06:25 +0200 Subject: [PATCH 06/10] Blackhole and Sabnzbd support handling rars now (some providers already use them, might be handy for in the future as well). --- couchpotato/core/downloaders/base.py | 9 +++-- couchpotato/core/downloaders/blackhole/main.py | 51 +++++++++++++------------- couchpotato/core/downloaders/sabnzbd/main.py | 5 ++- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/couchpotato/core/downloaders/base.py b/couchpotato/core/downloaders/base.py index 8156af9..3b139e4 100644 --- a/couchpotato/core/downloaders/base.py +++ b/couchpotato/core/downloaders/base.py @@ -2,6 +2,7 @@ from couchpotato.core.event import addEvent from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.environment import Env +from couchpotato.core.helpers.encoding import toSafeString import os log = CPLog(__name__) @@ -17,11 +18,11 @@ class Downloader(Plugin): def download(self, data = {}): pass - def createFileName(self, directory, data = {}, content, movie): - if "DOCTYPE nzb" not in content: + def createFileName(self, data, file, movie): + if "DOCTYPE nzb" not in file: if data.get('type') == 'nzb': - return os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , 'rar') - return os.path.join(directory, '%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , data.get('type')) + return os.path.join('%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , 'rar')) + return os.path.join('%s%s.%s' % (toSafeString(data.get('name')), self.cpTag(movie) , data.get('type'))) def cpTag(self, movie): if Env.setting('enabled', 'renamer'): diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index 7afb905..ebb97fd 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -11,36 +11,37 @@ class Blackhole(Downloader): type = ['nzb', 'torrent'] def download(self, data = {}, movie = {}): - if self.isDisabled() or not self.isCorrectType(data.get('type') or not self.conf('use_for') in ['both', data.get('type')]): return directory = self.conf('directory') - if not directory or not os.path.isdir(directory): log.error('No directory set for blackhole %s download.' % data.get('type')) else: - try: - file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) - if "no nzb" in file: - log.error('No nzb available!') - - fullPath = self.createFileName(directory, data, file, movie) - - try: - if not os.path.isfile(fullPath): - log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) - else: - log.info('File %s already exists.' % fullPath) - return True - - except: - log.error('Failed to download to blackhole %s' % traceback.format_exc()) - pass - - with open(fullPath, 'wb') as f: - f.write(file) - except: - log.debug('Failed to download file: %s' % data.get('name')) - return False + try: + file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) + + if "no nzb" in file: + log.error('No nzb available!') + return False + + fullPath = os.path.join(directory, self.createFileName(data, file, movie)) + + try: + if not os.path.isfile(fullPath): + log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) + with open(fullPath, 'wb') as f: + f.write(file) + return True + else: + log.info('File %s already exists.' % fullPath) + return True + + except: + log.error('Failed to download to blackhole %s' % traceback.format_exc()) + pass + + except: + log.debug('Failed to download file: %s' % data.get('name')) + return False return False diff --git a/couchpotato/core/downloaders/sabnzbd/main.py b/couchpotato/core/downloaders/sabnzbd/main.py index 8d56a8f..e07d3f4 100644 --- a/couchpotato/core/downloaders/sabnzbd/main.py +++ b/couchpotato/core/downloaders/sabnzbd/main.py @@ -44,13 +44,16 @@ class Sabnzbd(Downloader): nzb_file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) + # If it's a .rar, it adds the .rar extension, otherwise it stays .nzb + nzb_filename = self.createFileName(data, nzb_file, movie) + if pp: params['script'] = pp_script_fn url = cleanHost(self.conf('host')) + "api?" + urlencode(params) try: - data = self.urlopen(url, params = {"nzbfile": (params['nzbname'] + ".nzb", nzb_file)}, multipart = True) + data = self.urlopen(url, params = {"nzbfile": (nzb_filename, nzb_file)}, multipart = True) except Exception: log.error("Unable to connect to SAB: %s" % traceback.format_exc()) return False From 936e216f1106fd342b657b9ea3a0da35c3df18ca Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Wed, 12 Oct 2011 01:12:06 +0200 Subject: [PATCH 07/10] Sabnzbd should be able to handle empty nzbns too, small fix for that. --- couchpotato/core/downloaders/sabnzbd/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/couchpotato/core/downloaders/sabnzbd/main.py b/couchpotato/core/downloaders/sabnzbd/main.py index e07d3f4..32aa326 100644 --- a/couchpotato/core/downloaders/sabnzbd/main.py +++ b/couchpotato/core/downloaders/sabnzbd/main.py @@ -44,6 +44,10 @@ class Sabnzbd(Downloader): nzb_file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) + if "no nzb" in nzb_file: + log.error('No nzb available!') + return False + # If it's a .rar, it adds the .rar extension, otherwise it stays .nzb nzb_filename = self.createFileName(data, nzb_file, movie) From 0655b30a3dbb2553f5477034d23e17b27da79748 Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Wed, 12 Oct 2011 13:33:44 +0200 Subject: [PATCH 08/10] Magic indentations baby! --- couchpotato/core/downloaders/blackhole/main.py | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index ebb97fd..1f45001 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -19,29 +19,29 @@ class Blackhole(Downloader): log.error('No directory set for blackhole %s download.' % data.get('type')) else: try: - file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) + file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) - if "no nzb" in file: - log.error('No nzb available!') - return False + if "no nzb" in file: + log.error('No nzb available!') + return False - fullPath = os.path.join(directory, self.createFileName(data, file, movie)) + fullPath = os.path.join(directory, self.createFileName(data, file, movie)) - try: - if not os.path.isfile(fullPath): - log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) - with open(fullPath, 'wb') as f: - f.write(file) - return True - else: - log.info('File %s already exists.' % fullPath) - return True + try: + if not os.path.isfile(fullPath): + log.info('Downloading %s to %s.' % (data.get('type'), fullPath)) + with open(fullPath, 'wb') as f: + f.write(file) + return True + else: + log.info('File %s already exists.' % fullPath) + return True - except: - log.error('Failed to download to blackhole %s' % traceback.format_exc()) - pass + except: + log.error('Failed to download to blackhole %s' % traceback.format_exc()) + pass except: - log.debug('Failed to download file: %s' % data.get('name')) - return False + log.debug('Failed to download file: %s' % data.get('name')) + return False return False From d9dc405ee56ad2780ab9763f6bab31ba527ac630 Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Wed, 12 Oct 2011 13:39:38 +0200 Subject: [PATCH 09/10] oops --- couchpotato/core/downloaders/blackhole/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/downloaders/blackhole/main.py b/couchpotato/core/downloaders/blackhole/main.py index 1f45001..0c2b876 100644 --- a/couchpotato/core/downloaders/blackhole/main.py +++ b/couchpotato/core/downloaders/blackhole/main.py @@ -21,7 +21,7 @@ class Blackhole(Downloader): try: file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) - if "no nzb" in file: + if len(file) < 50: log.error('No nzb available!') return False @@ -34,8 +34,8 @@ class Blackhole(Downloader): f.write(file) return True else: - log.info('File %s already exists.' % fullPath) - return True + log.info('File %s already exists.' % fullPath) + return True except: log.error('Failed to download to blackhole %s' % traceback.format_exc()) From 07a179af1cfae94b7a971ee6b3532312f5065fa2 Mon Sep 17 00:00:00 2001 From: bwq <bwq@irc.efnet.com> Date: Wed, 12 Oct 2011 13:40:46 +0200 Subject: [PATCH 10/10] More general fix for checking empty/missing nzbs. --- couchpotato/core/downloaders/sabnzbd/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/sabnzbd/main.py b/couchpotato/core/downloaders/sabnzbd/main.py index 32aa326..5a802ac 100644 --- a/couchpotato/core/downloaders/sabnzbd/main.py +++ b/couchpotato/core/downloaders/sabnzbd/main.py @@ -44,7 +44,7 @@ class Sabnzbd(Downloader): nzb_file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) - if "no nzb" in nzb_file: + if len(nzb_file) < 50: log.error('No nzb available!') return False