From fc2ebeb245eb75a139ecd10d4159e93cdb70fecf Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Fri, 25 Nov 2022 10:24:07 -0500 Subject: [PATCH] Extract total status parsing from `core.processor.nzbget.parse_status` -> `_parse_total_status` --- core/processor/nzbget.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/processor/nzbget.py b/core/processor/nzbget.py index b94378b5..ac6e79cb 100644 --- a/core/processor/nzbget.py +++ b/core/processor/nzbget.py @@ -29,15 +29,21 @@ def parse_failure_link(): return os.environ.get('NZBPR__DNZB_FAILURE') +def _parse_total_status(): + status = 0 + if not os.environ['NZBPP_TOTALSTATUS'] == 'SUCCESS': + logger.info('Download failed with status {0}.'.format( + os.environ['NZBPP_STATUS'])) + status = 1 + return status + return status + + def parse_status(): status = 0 # Check if the script is called from nzbget 13.0 or later if 'NZBPP_TOTALSTATUS' in os.environ: - if not os.environ['NZBPP_TOTALSTATUS'] == 'SUCCESS': - logger.info('Download failed with status {0}.'.format( - os.environ['NZBPP_STATUS'])) - status = 1 - + status = _parse_total_status() else: # Check par status if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ[