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,21 +413,22 @@ def main(args, section=None):
result = 0
status = 0
# NZBGet V11+
# Check if the script is called from nzbget 11.0 or later
if os.environ.has_key('NZBOP_SCRIPTDIR') and not os.environ['NZBOP_VERSION'][0:5] < '11.0':
logger.info("Script triggered from NZBGet (11.0 or later).")
# NZBGet
if os.environ.has_key('NZBOP_SCRIPTDIR'):
logger.info("Script triggered from NZBGet Version %s." %(str(os.environ['NZBOP_VERSION'][0:5])))
if os.environ['NZBOP_UNPACK'] != 'yes':
logger.error("Please enable option \"Unpack\" in nzbget configuration file, exiting")
# Check if the script is called from nzbget 13.0 or later
if os.environ.has_key('NZBPP_TOTALSTATUS'):
if not os.environ['NZBPP_TOTALSTATUS'] == 'SUCCESS':
logger.info("Download failed with status %s." %(os.environ['NZBPP_STATUS']))
status = 1
# Check if the script is called from nzbget 11.0 or later
elif os.environ['NZBOP_VERSION'][0:5] < '11.0':
logger.error("NZBGet Version %s is not supported. Please update NZBGet." %(str(os.environ['NZBOP_VERSION'][0:5])))
sys.exit(nzbtomedia.NZBGET_POSTPROCESS_ERROR)
# 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)
else:
if os.environ['NZBPP_PARSTATUS'] == '1' or os.environ['NZBPP_PARSTATUS'] == '4':
logger.warning("Par-repair failed, setting status \"failed\"")
status = 1
@ -451,12 +452,6 @@ def main(args, section=None):
"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 if destination directory exists (important for reprocessing of history items)
if not os.path.isdir(os.environ['NZBPP_DIRECTORY']):
logger.error("Nothing to post-process: destination directory %s doesn't exist. Setting status failed" % (
os.environ['NZBPP_DIRECTORY']))
status = 1
# Check for download_id to pass to CouchPotato
download_id = ""
if os.environ.has_key('NZBPR_COUCHPOTATO'):