mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
PEP8: Tests for membership should use in/not in
PEP8: .has_key() is deprecated, use in
This commit is contained in:
parent
c2bf14f775
commit
84a89c62d5
2 changed files with 11 additions and 11 deletions
|
@ -203,7 +203,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
||||||
logger.debug('Checking for archives to extract in directory: {0}'.format(inputDirectory))
|
logger.debug('Checking for archives to extract in directory: {0}'.format(inputDirectory))
|
||||||
core.extractFiles(inputDirectory, outputDestination, keep_archive)
|
core.extractFiles(inputDirectory, outputDestination, keep_archive)
|
||||||
|
|
||||||
if not inputCategory in core.NOFLATTEN: # don't flatten hp in case multi cd albums, and we need to copy this back later.
|
if inputCategory not in core.NOFLATTEN: # don't flatten hp in case multi cd albums, and we need to copy this back later.
|
||||||
core.flatten(outputDestination)
|
core.flatten(outputDestination)
|
||||||
|
|
||||||
# Now check if video files exist in destination:
|
# Now check if video files exist in destination:
|
||||||
|
@ -220,7 +220,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
|
||||||
logger.warning("Found no media files in {0}".format(outputDestination))
|
logger.warning("Found no media files in {0}".format(outputDestination))
|
||||||
|
|
||||||
# Only these sections can handling failed downloads so make sure everything else gets through without the check for failed
|
# Only these sections can handling failed downloads so make sure everything else gets through without the check for failed
|
||||||
if not sectionName in ['CouchPotato', 'SickBeard', 'NzbDrone']:
|
if sectionName not in ['CouchPotato', 'SickBeard', 'NzbDrone']:
|
||||||
status = 0
|
status = 0
|
||||||
|
|
||||||
logger.info("Calling {0}:{1} to post-process:{2}".format(sectionName, usercat, inputName))
|
logger.info("Calling {0}:{1} to post-process:{2}".format(sectionName, usercat, inputName))
|
||||||
|
|
|
@ -624,7 +624,7 @@ def process(inputDirectory, inputName=None, status=0, clientAgent='manual', down
|
||||||
if clientAgent != 'manual':
|
if clientAgent != 'manual':
|
||||||
# update download status in our DB
|
# update download status in our DB
|
||||||
update_downloadInfoStatus(inputName, 1)
|
update_downloadInfoStatus(inputName, 1)
|
||||||
if not sectionName in ['UserScript', 'NzbDrone']:
|
if sectionName not in ['UserScript', 'NzbDrone']:
|
||||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||||
cleanDir(inputDirectory, sectionName, inputCategory)
|
cleanDir(inputDirectory, sectionName, inputCategory)
|
||||||
|
|
||||||
|
@ -647,7 +647,7 @@ def main(args, section=None):
|
||||||
status = 0
|
status = 0
|
||||||
|
|
||||||
# NZBGet
|
# NZBGet
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR'):
|
if 'NZBOP_SCRIPTDIR' in os.environ:
|
||||||
# Check if the script is called from nzbget 11.0 or later
|
# Check if the script is called from nzbget 11.0 or later
|
||||||
if os.environ['NZBOP_VERSION'][0:5] < '11.0':
|
if os.environ['NZBOP_VERSION'][0:5] < '11.0':
|
||||||
logger.error("NZBGet Version {0} is not supported. Please update NZBGet.".format(os.environ['NZBOP_VERSION']))
|
logger.error("NZBGet Version {0} is not supported. Please update NZBGet.".format(os.environ['NZBOP_VERSION']))
|
||||||
|
@ -656,7 +656,7 @@ def main(args, section=None):
|
||||||
logger.info("Script triggered from NZBGet Version {0}.".format(os.environ['NZBOP_VERSION']))
|
logger.info("Script triggered from NZBGet Version {0}.".format(os.environ['NZBOP_VERSION']))
|
||||||
|
|
||||||
# Check if the script is called from nzbget 13.0 or later
|
# Check if the script is called from nzbget 13.0 or later
|
||||||
if os.environ.has_key('NZBPP_TOTALSTATUS'):
|
if 'NZBPP_TOTALSTATUS' in os.environ:
|
||||||
if not os.environ['NZBPP_TOTALSTATUS'] == 'SUCCESS':
|
if not os.environ['NZBPP_TOTALSTATUS'] == 'SUCCESS':
|
||||||
logger.info("Download failed with status {0}.".format(os.environ['NZBPP_STATUS']))
|
logger.info("Download failed with status {0}.".format(os.environ['NZBPP_STATUS']))
|
||||||
status = 1
|
status = 1
|
||||||
|
@ -689,13 +689,13 @@ def main(args, section=None):
|
||||||
# Check for download_id to pass to CouchPotato
|
# Check for download_id to pass to CouchPotato
|
||||||
download_id = ""
|
download_id = ""
|
||||||
failureLink = None
|
failureLink = None
|
||||||
if os.environ.has_key('NZBPR_COUCHPOTATO'):
|
if 'NZBPR_COUCHPOTATO' in os.environ:
|
||||||
download_id = os.environ['NZBPR_COUCHPOTATO']
|
download_id = os.environ['NZBPR_COUCHPOTATO']
|
||||||
elif os.environ.has_key('NZBPR_DRONE'):
|
elif 'NZBPR_DRONE' in os.environ:
|
||||||
download_id = os.environ['NZBPR_DRONE']
|
download_id = os.environ['NZBPR_DRONE']
|
||||||
elif os.environ.has_key('NZBPR_SONARR'):
|
elif 'NZBPR_SONARR' in os.environ:
|
||||||
download_id = os.environ['NZBPR_SONARR']
|
download_id = os.environ['NZBPR_SONARR']
|
||||||
if os.environ.has_key('NZBPR__DNZB_FAILURE'):
|
if 'NZBPR__DNZB_FAILURE' in os.environ:
|
||||||
failureLink = os.environ['NZBPR__DNZB_FAILURE']
|
failureLink = os.environ['NZBPR__DNZB_FAILURE']
|
||||||
|
|
||||||
# All checks done, now launching the script.
|
# All checks done, now launching the script.
|
||||||
|
@ -791,14 +791,14 @@ def main(args, section=None):
|
||||||
logger.info("The {0} script completed successfully.".format(args[0]))
|
logger.info("The {0} script completed successfully.".format(args[0]))
|
||||||
if result[1]:
|
if result[1]:
|
||||||
print result[1] + "!" # For SABnzbd Status display.
|
print result[1] + "!" # For SABnzbd Status display.
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
if 'NZBOP_SCRIPTDIR' in os.environ: # return code for nzbget v11
|
||||||
del core.MYAPP
|
del core.MYAPP
|
||||||
return core.NZBGET_POSTPROCESS_SUCCESS
|
return core.NZBGET_POSTPROCESS_SUCCESS
|
||||||
else:
|
else:
|
||||||
logger.error("A problem was reported in the {0} script.".format(args[0]))
|
logger.error("A problem was reported in the {0} script.".format(args[0]))
|
||||||
if result[1]:
|
if result[1]:
|
||||||
print result[1] + "!" # For SABnzbd Status display.
|
print result[1] + "!" # For SABnzbd Status display.
|
||||||
if os.environ.has_key('NZBOP_SCRIPTDIR'): # return code for nzbget v11
|
if 'NZBOP_SCRIPTDIR' in os.environ: # return code for nzbget v11
|
||||||
del core.MYAPP
|
del core.MYAPP
|
||||||
return core.NZBGET_POSTPROCESS_ERROR
|
return core.NZBGET_POSTPROCESS_ERROR
|
||||||
del core.MYAPP
|
del core.MYAPP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue