From 78f9987ecac4c81a0a2a3820611f9a3d6555bef9 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 13 May 2012 12:30:36 +0200 Subject: [PATCH] Use download function if exists. fixes #257 --- couchpotato/core/downloaders/sabnzbd/main.py | 6 +++--- couchpotato/core/providers/nzb/newzbin/main.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/downloaders/sabnzbd/main.py b/couchpotato/core/downloaders/sabnzbd/main.py index 837ab063..5505438e 100644 --- a/couchpotato/core/downloaders/sabnzbd/main.py +++ b/couchpotato/core/downloaders/sabnzbd/main.py @@ -2,7 +2,7 @@ from couchpotato.core.downloaders.base import Downloader from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.helpers.variable import cleanHost from couchpotato.core.logger import CPLog -from inspect import isfunction +from inspect import ismethod, isfunction from tempfile import mkstemp import base64 import os @@ -42,10 +42,10 @@ class Sabnzbd(Downloader): 'nzbname': self.createNzbName(data, movie), } - if isfunction(data.get('download')): + if data.get('download') and (ismethod(data.get('download')) or isfunction(data.get('download'))): nzb_file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) - if len(nzb_file) < 50: + if not nzb_file or len(nzb_file) < 50: log.error('No nzb available!') return False diff --git a/couchpotato/core/providers/nzb/newzbin/main.py b/couchpotato/core/providers/nzb/newzbin/main.py index d68bbae3..80f856ec 100644 --- a/couchpotato/core/providers/nzb/newzbin/main.py +++ b/couchpotato/core/providers/nzb/newzbin/main.py @@ -138,7 +138,7 @@ class Newzbin(NZBProvider, RSS): 'username' : self.conf('username'), 'password' : self.conf('password'), 'reportid' : nzb_id - }) + }, show_error = False) except Exception, e: log.error('Failed downloading from newzbin, check credit: %s' % e) return False