mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 22:03:13 -07:00
Extract health status parsing from core.processor.nzbget.parse_status
-> _parse_health_status
This commit is contained in:
parent
d98ab61b0e
commit
bb3465040f
1 changed files with 25 additions and 16 deletions
|
@ -55,18 +55,9 @@ def _parse_unpack_status():
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
||||||
def parse_status():
|
def _parse_health_status():
|
||||||
|
"""Parse nzbget download health from environment."""
|
||||||
status = 0
|
status = 0
|
||||||
# Check if the script is called from nzbget 13.0 or later
|
|
||||||
if 'NZBPP_TOTALSTATUS' in os.environ:
|
|
||||||
status = _parse_total_status()
|
|
||||||
else:
|
|
||||||
# Check par status
|
|
||||||
par_status = _parse_par_status()
|
|
||||||
|
|
||||||
# Check unpack status
|
|
||||||
unpack_status = _parse_unpack_status()
|
|
||||||
|
|
||||||
if os.environ['NZBPP_UNPACKSTATUS'] == '0' and os.environ[
|
if os.environ['NZBPP_UNPACKSTATUS'] == '0' and os.environ[
|
||||||
'NZBPP_PARSTATUS'] == '0':
|
'NZBPP_PARSTATUS'] == '0':
|
||||||
# Unpack was skipped due to nzb-file properties or due to errors during par-check
|
# Unpack was skipped due to nzb-file properties or due to errors during par-check
|
||||||
|
@ -83,7 +74,25 @@ def parse_status():
|
||||||
'Par-check/repair disabled or no .par2 files found, and Unpack not required. Health is ok so handle as though download successful')
|
'Par-check/repair disabled or no .par2 files found, and Unpack not required. Health is ok so handle as though download successful')
|
||||||
logger.info(
|
logger.info(
|
||||||
'Please check your Par-check/repair settings for future downloads.')
|
'Please check your Par-check/repair settings for future downloads.')
|
||||||
return par_status or unpack_status or 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:
|
||||||
|
status = _parse_total_status()
|
||||||
|
else:
|
||||||
|
# Check par status
|
||||||
|
par_status = _parse_par_status()
|
||||||
|
|
||||||
|
# Check unpack status
|
||||||
|
unpack_status = _parse_unpack_status()
|
||||||
|
|
||||||
|
# Check download health
|
||||||
|
health_status = _parse_health_status()
|
||||||
|
|
||||||
|
return par_status or unpack_status or health_status or status
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue