Use download function if exists. fixes #257
This commit is contained in:
1 parent
04f39edd72
commit
78f9987eca
2 files changed
+4
-4
No files matched your search
@@ -2,7 +2,7 @@ from couchpotato.core.downloaders.base import Downloader
|
|||||||
from couchpotato.core.helpers.encoding import tryUrlencode
|
from couchpotato.core.helpers.encoding import tryUrlencode
|
||||||
from couchpotato.core.helpers.variable import cleanHost
|
from couchpotato.core.helpers.variable import cleanHost
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from inspect import isfunction
|
from inspect import ismethod, isfunction
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
@@ -42,10 +42,10 @@ class Sabnzbd(Downloader):
|
|||||||
'nzbname': self.createNzbName(data, movie),
|
'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'))
|
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!')
|
log.error('No nzb available!')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class Newzbin(NZBProvider, RSS):
|
|||||||
'username' : self.conf('username'),
|
'username' : self.conf('username'),
|
||||||
'password' : self.conf('password'),
|
'password' : self.conf('password'),
|
||||||
'reportid' : nzb_id
|
'reportid' : nzb_id
|
||||||
})
|
}, show_error = False)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error('Failed downloading from newzbin, check credit: %s' % e)
|
log.error('Failed downloading from newzbin, check credit: %s' % e)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in new issue
Block a user