mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -07:00
add full parsing of syno downloads. #1671
This commit is contained in:
parent
f0f64b052e
commit
2a5afd2d7d
1 changed files with 13 additions and 11 deletions
|
@ -84,19 +84,21 @@ def parse_transmission(args):
|
|||
|
||||
def parse_synods(args):
|
||||
# Synology/Transmission usage: call TorrenToMedia.py (%TR_TORRENT_DIR% %TR_TORRENT_NAME% is passed on as environmental variables)
|
||||
#input_directory =os.path.normpath(os.getenv('TR_TORRENT_DIR'))
|
||||
input_name = os.getenv('TR_TORRENT_NAME')
|
||||
input_category = '' # We dont have a category yet
|
||||
input_hash = os.getenv('TR_TORRENT_HASH')
|
||||
input_id = os.getenv('TR_TORRENT_ID')
|
||||
res = core.TORRENT_CLASS.tasks_info(input_id, additional_param='detail')
|
||||
try:
|
||||
input_directory = res['tasks'][0]['additional']['detail']['destination']
|
||||
except:
|
||||
logger.error('result keys are {0}'.format(res.keys()))
|
||||
logger.info('result from syno {0}'.format(res))
|
||||
input_directory = ''
|
||||
|
||||
input_id = ''
|
||||
input_category = ''
|
||||
input_name = os.getenv('TR_TORRENT_NAME')
|
||||
input_hash = os.getenv('TR_TORRENT_HASH')
|
||||
res = core.TORRENT_CLASS.tasks_list(additional_param='detail')
|
||||
logger.debug('result from syno {0}'.format(res))
|
||||
if res['success']:
|
||||
try:
|
||||
tasks = res['data']['tasks']
|
||||
task = [ task for task in tasks if task['title'] == input_name ][0]
|
||||
input_id = task['id']
|
||||
input_directory = task['additional']['detail']['destination']
|
||||
except:
|
||||
logger.error('unable to find download details in Synology DS')
|
||||
return input_directory, input_name, input_category, input_hash, input_id
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue