From ade9e60a8b81da372f0c99474141021b2cde145d Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Wed, 14 May 2014 17:21:28 +0930 Subject: [PATCH] fixed crash (with no error code) when no section. fixes #390 --- TorrentToMedia.py | 6 ++++++ nzbToMedia.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index d5f0adf2..a674a8c8 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -39,6 +39,12 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, # auto-detect section section = nzbtomedia.CFG.findsection(inputCategory).isenabled() + if section is None: + logger.error( + 'Category:[%s] is not defined or is not enabled. Please rename it or ensure it is enabled for teh appropriate section in your autoProcessMedia.cfg and try again.' % ( + inputCategory)) + return -1 + if len(section) > 1: logger.error( 'Category:[%s] is not unique, %s are using it. Please rename it or disable all other sections using the same category name in your autoProcessMedia.cfg and try again.' % ( diff --git a/nzbToMedia.py b/nzbToMedia.py index a7043906..690cd245 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -326,6 +326,12 @@ def process(inputDirectory, inputName=None, status=0, clientAgent='manual', down # auto-detect section section = nzbtomedia.CFG.findsection(inputCategory).isenabled() + if section is None: + logger.error( + 'Category:[%s] is not defined or is not enabled. Please rename it or ensure it is enabled for teh appropriate section in your autoProcessMedia.cfg and try again.' % ( + inputCategory)) + return -1 + if len(section) > 1: logger.error( 'Category:[%s] is not unique, %s are using it. Please rename it or disable all other sections using the same category name in your autoProcessMedia.cfg and try again.' % (