From 0e239917245d6600e768f7e867e56ddd0e7b32cc Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Fri, 2 Aug 2019 09:37:02 +1200 Subject: [PATCH] Fixes for user_script categories. #1643 --- TorrentToMedia.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index 42707b1a..3ddd2eae 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -76,16 +76,19 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp # auto-detect section section = core.CFG.findsection(input_category).isenabled() - if section is None: - section = core.CFG.findsection('ALL').isenabled() - if section is None: - logger.error('Category:[{0}] is not defined or is not enabled. ' - 'Please rename it or ensure it is enabled for the appropriate section ' - 'in your autoProcessMedia.cfg and try again.'.format - (input_category)) - return [-1, ''] + if section is None: #Check for user_scripts for 'ALL' and 'UNCAT' + if usercat in core.CATEGORIES: + section = core.CFG.findsection('ALL').isenabled() + usercat = 'ALL' else: - usercat = 'ALL' + section = core.CFG.findsection('UNCAT').isenabled() + usercat = 'UNCAT' + if section is None: # We haven't found any categories to process. + logger.error('Category:[{0}] is not defined or is not enabled. ' + 'Please rename it or ensure it is enabled for the appropriate section ' + 'in your autoProcessMedia.cfg and try again.'.format + (input_category)) + return [-1, ''] if len(section) > 1: logger.error('Category:[{0}] is not unique, {1} are using it. '