Added config options
This commit is contained in:
1 parent
4aae3c45ea
commit
db2c9e5156
2 files changed
+22
-6
No files matched your search
@@ -35,11 +35,25 @@ config = [{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'manual',
|
'name': 'manual',
|
||||||
'default': 0,
|
'default': False,
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
'advanced': True,
|
'advanced': True,
|
||||||
'description': 'Disable this downloader for automated searches, but use it when I manually send a release.',
|
'description': 'Disable this downloader for automated searches, but use it when I manually send a release.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'download failed',
|
||||||
|
'default': True,
|
||||||
|
'type': 'bool',
|
||||||
|
'advanced': True,
|
||||||
|
'description': 'Try next the next best release for a movie after a download failed.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'delete failed',
|
||||||
|
'default': True,
|
||||||
|
'type': 'bool',
|
||||||
|
'advanced': True,
|
||||||
|
'description': 'Delete a release after it\'s download failed.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ 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
|
||||||
import traceback
|
import traceback
|
||||||
import urllib2
|
|
||||||
import requests
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
@@ -69,6 +67,9 @@ class Sabnzbd(Downloader):
|
|||||||
if self.isDisabled(manual = True) or not self.isCorrectType(data.get('type')):
|
if self.isDisabled(manual = True) or not self.isCorrectType(data.get('type')):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not self.conf('download failed', default = True):
|
||||||
|
return False
|
||||||
|
|
||||||
log.info('Checking download status of "%s" at SABnzbd.', data.get('name'))
|
log.info('Checking download status of "%s" at SABnzbd.', data.get('name'))
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
@@ -80,7 +81,7 @@ class Sabnzbd(Downloader):
|
|||||||
log.debug('Opening: %s', url)
|
log.debug('Opening: %s', url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
history = json.load(urllib2.urlopen(url))
|
history = json.load(self.urlopen(url))
|
||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.error(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
@@ -91,9 +92,10 @@ class Sabnzbd(Downloader):
|
|||||||
for slot in history['history']['slots']:
|
for slot in history['history']['slots']:
|
||||||
log.debug('Found %s in SabNZBd history, which has %s', (slot['name'], slot['status']))
|
log.debug('Found %s in SabNZBd history, which has %s', (slot['name'], slot['status']))
|
||||||
if slot['name'] == nzbname and slot['status'] == 'Failed':
|
if slot['name'] == nzbname and slot['status'] == 'Failed':
|
||||||
log.debug('%s failed downloading, deleting...', slot['name'])
|
|
||||||
|
|
||||||
# Delete failed download
|
# Delete failed download
|
||||||
|
if self.conf('delete failed', default = True):
|
||||||
|
log.info('%s failed downloading, deleting...', slot['name'])
|
||||||
params = {
|
params = {
|
||||||
'apikey': self.conf('api_key'),
|
'apikey': self.conf('api_key'),
|
||||||
'mode': 'history',
|
'mode': 'history',
|
||||||
@@ -107,7 +109,7 @@ class Sabnzbd(Downloader):
|
|||||||
except:
|
except:
|
||||||
log.error(traceback.format_exc())
|
log.error(traceback.format_exc())
|
||||||
|
|
||||||
# Return failed
|
# Return download failed
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
Reference in new issue
Block a user