Add destination support to Synology downloader
This commit is contained in:
@@ -33,7 +33,7 @@ class Synology(Downloader):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Send request to Synology
|
# Send request to Synology
|
||||||
srpc = SynologyRPC(host[0], host[1], self.conf('username'), self.conf('password'))
|
srpc = SynologyRPC(host[0], host[1], self.conf('username'), self.conf('password'), self.conf('destination'))
|
||||||
if data['protocol'] == 'torrent_magnet':
|
if data['protocol'] == 'torrent_magnet':
|
||||||
log.info('Adding torrent URL %s', data['url'])
|
log.info('Adding torrent URL %s', data['url'])
|
||||||
response = srpc.create_task(url = data['url'])
|
response = srpc.create_task(url = data['url'])
|
||||||
@@ -84,7 +84,7 @@ class SynologyRPC(object):
|
|||||||
|
|
||||||
"""SynologyRPC lite library"""
|
"""SynologyRPC lite library"""
|
||||||
|
|
||||||
def __init__(self, host = 'localhost', port = 5000, username = None, password = None):
|
def __init__(self, host = 'localhost', port = 5000, username = None, password = None, destination = None):
|
||||||
|
|
||||||
super(SynologyRPC, self).__init__()
|
super(SynologyRPC, self).__init__()
|
||||||
|
|
||||||
@@ -92,6 +92,7 @@ class SynologyRPC(object):
|
|||||||
self.auth_url = 'http://%s:%s/webapi/auth.cgi' % (host, port)
|
self.auth_url = 'http://%s:%s/webapi/auth.cgi' % (host, port)
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
|
self.destination = destination
|
||||||
self.session_name = 'DownloadStation'
|
self.session_name = 'DownloadStation'
|
||||||
|
|
||||||
def _login(self):
|
def _login(self):
|
||||||
@@ -144,6 +145,10 @@ class SynologyRPC(object):
|
|||||||
'version': '1',
|
'version': '1',
|
||||||
'method': 'create',
|
'method': 'create',
|
||||||
'_sid': self.sid}
|
'_sid': self.sid}
|
||||||
|
|
||||||
|
if self.destination and len(self.destination) > 0:
|
||||||
|
args['destination'] = self.destination
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
log.info('Login success, adding torrent URI')
|
log.info('Login success, adding torrent URI')
|
||||||
args['uri'] = url
|
args['uri'] = url
|
||||||
@@ -195,6 +200,11 @@ config = [{
|
|||||||
'name': 'password',
|
'name': 'password',
|
||||||
'type': 'password',
|
'type': 'password',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'destination',
|
||||||
|
'description': 'Specify <strong>existing</strong> destination share to where your files will be downloaded, usually <strong>Downloads</strong>',
|
||||||
|
'advanced': True,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'use_for',
|
'name': 'use_for',
|
||||||
'label': 'Use for',
|
'label': 'Use for',
|
||||||
|
|||||||
Reference in New Issue
Block a user