|
|
@ -33,7 +33,7 @@ class Synology(Downloader): |
|
|
|
|
|
|
|
try: |
|
|
|
# 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': |
|
|
|
log.info('Adding torrent URL %s', data['url']) |
|
|
|
response = srpc.create_task(url = data['url']) |
|
|
@ -84,7 +84,7 @@ class SynologyRPC(object): |
|
|
|
|
|
|
|
"""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__() |
|
|
|
|
|
|
@ -92,6 +92,7 @@ class SynologyRPC(object): |
|
|
|
self.auth_url = 'http://%s:%s/webapi/auth.cgi' % (host, port) |
|
|
|
self.username = username |
|
|
|
self.password = password |
|
|
|
self.destination = destination |
|
|
|
self.session_name = 'DownloadStation' |
|
|
|
|
|
|
|
def _login(self): |
|
|
@ -144,6 +145,10 @@ class SynologyRPC(object): |
|
|
|
'version': '1', |
|
|
|
'method': 'create', |
|
|
|
'_sid': self.sid} |
|
|
|
|
|
|
|
if self.destination and len(self.destination) > 0: |
|
|
|
args['destination'] = self.destination |
|
|
|
|
|
|
|
if url: |
|
|
|
log.info('Login success, adding torrent URI') |
|
|
|
args['uri'] = url |
|
|
@ -196,6 +201,11 @@ config = [{ |
|
|
|
'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', |
|
|
|
'label': 'Use for', |
|
|
|
'default': 'both', |
|
|
|