add new NZBGet status check for V13.

This commit is contained in:
clinton-hall 2014-05-29 16:08:34 +09:30
commit 108fea700b

View file

@ -413,49 +413,44 @@ def main(args, section=None):
result = 0 result = 0
status = 0 status = 0
# NZBGet V11+ # NZBGet
# Check if the script is called from nzbget 11.0 or later if os.environ.has_key('NZBOP_SCRIPTDIR'):
if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0': logger.info("Script triggered from NZBGet Version %s." %(str(os.environ['NZBOP_VERSION'][0:5])))
logger.info("Script triggered from NZBGet (11.0 or later).")
if os.environ['NZBOP_UNPACK'] != 'yes': # Check if the script is called from nzbget 13.0 or later
logger.error("Please enable option \"Unpack\" in nzbget configuration file, exiting") if os.environ.has_key('NZBPP_TOTALSTATUS'):
sys.exit(nzbtomedia.NZBGET_POSTPROCESS_ERROR) if not os.environ['NZBPP_TOTALSTATUS'] == 'SUCCESS':
logger.info("Download failed with status %s." %(os.environ['NZBPP_STATUS']))
# Check par status
if os.environ['NZBPP_PARSTATUS'] == '3':
logger.warning("Par-check successful, but Par-repair disabled, exiting")
logger.info("Please check your Par-repair settings for future downloads.")
sys.exit(nzbtomedia.NZBGET_POSTPROCESS_NONE)
if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
logger.warning("Par-repair failed, setting status \"failed\"")
status = 1
# Check unpack status
if os.environ['NZBPP_UNPACKSTATUS'] == '1':
logger.warning("Unpack failed, setting status \"failed\"")
status = 1
if os.environ['NZBPP_UNPACKSTATUS'] == '0' and os.environ['NZBPP_PARSTATUS'] == '0':
# Unpack was skipped due to nzb-file properties or due to errors during par-check
if os.environ['NZBPP_HEALTH'] < 1000:
logger.warning(
"Download health is compromised and Par-check/repair disabled or no .par2 files found. Setting status \"failed\"")
logger.info("Please check your Par-check/repair settings for future downloads.")
status = 1 status = 1
else: # Check if the script is called from nzbget 11.0 or later
logger.info( elif os.environ['NZBOP_VERSION'][0:5] < '11.0':
"Par-check/repair disabled or no .par2 files found, and Unpack not required. Health is ok so handle as though download successful") logger.error("NZBGet Version %s is not supported. Please update NZBGet." %(str(os.environ['NZBOP_VERSION'][0:5])))
logger.info("Please check your Par-check/repair settings for future downloads.") sys.exit(nzbtomedia.NZBGET_POSTPROCESS_ERROR)
# Check if destination directory exists (important for reprocessing of history items) else:
if not os.path.isdir(os.environ['NZBPP_DIRECTORY']): if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
logger.error("Nothing to post-process: destination directory %s doesn't exist. Setting status failed" % ( logger.warning("Par-repair failed, setting status \"failed\"")
os.environ['NZBPP_DIRECTORY'])) status = 1
status = 1
# Check unpack status
if os.environ['NZBPP_UNPACKSTATUS'] == '1':
logger.warning("Unpack failed, setting status \"failed\"")
status = 1
if os.environ['NZBPP_UNPACKSTATUS'] == '0' and os.environ['NZBPP_PARSTATUS'] == '0':
# Unpack was skipped due to nzb-file properties or due to errors during par-check
if os.environ['NZBPP_HEALTH'] < 1000:
logger.warning(
"Download health is compromised and Par-check/repair disabled or no .par2 files found. Setting status \"failed\"")
logger.info("Please check your Par-check/repair settings for future downloads.")
status = 1
else:
logger.info(
"Par-check/repair disabled or no .par2 files found, and Unpack not required. Health is ok so handle as though download successful")
logger.info("Please check your Par-check/repair settings for future downloads.")
# Check for download_id to pass to CouchPotato # Check for download_id to pass to CouchPotato
download_id = "" download_id = ""