From 1ec83ae98eeff9ded381d904cb8b70f0f818316c Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 3 Aug 2019 11:56:53 +1200 Subject: [PATCH] fixes for user-script #1643 --- TorrentToMedia.py | 3 ++- core/user_scripts.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 3ddd2eae..157a334b 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -111,7 +111,8 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp torrent_no_link = int(section.get('Torrent_NoLink', 0)) keep_archive = int(section.get('keep_archive', 0)) extract = int(section.get('extract', 0)) - extensions = section.get('user_script_mediaExtensions', '').lower().split(',') + extensions = section.get('user_script_mediaExtensions', '') + print(extensions) unique_path = int(section.get('unique_path', 1)) if client_agent != 'manual': diff --git a/core/user_scripts.py b/core/user_scripts.py index 45adb45b..9c357ee8 100644 --- a/core/user_scripts.py +++ b/core/user_scripts.py @@ -14,6 +14,10 @@ import core from core import logger, transcoder from core.plugins.subtitles import import_subs from core.utils import list_media_files, remove_dir +from core.auto_process.common import ( + ProcessResult, +) + def external_script(output_destination, torrent_name, torrent_label, settings): @@ -29,7 +33,10 @@ def external_script(output_destination, torrent_name, torrent_label, settings): core.USER_SCRIPT = settings.get('user_script_path') if not core.USER_SCRIPT or core.USER_SCRIPT == 'None': # do nothing and return success. - return [0, ''] + return ProcessResult( + status_code=0, + message='', + ) try: core.USER_SCRIPT_PARAM = settings['user_script_param'] if isinstance(core.USER_SCRIPT_PARAM, str): @@ -122,4 +129,7 @@ def external_script(output_destination, torrent_name, torrent_label, settings): elif core.USER_SCRIPT_CLEAN == int(1) and num_files_new != 0: logger.info('{0} files were processed, but {1} still remain. outputDirectory will not be cleaned.'.format( num_files, num_files_new)) - return [final_result, ''] + return ProcessResult( + status_code=final_result, + message='', + )