This commit is contained in:
clinton-hall 2014-08-01 22:35:53 +09:30
commit 22342a4c31

View file

@ -246,33 +246,34 @@ class autoProcessMovie:
logger.postprocess("Deleting failed files and folder %s" % dirName, section) logger.postprocess("Deleting failed files and folder %s" % dirName, section)
rmDir(dirName) rmDir(dirName)
if not download_id: if not release_id and not media_id:
logger.error("Could not find a downloaded movie in the database matching %s, exiting!" % inputName, logger.error("Could not find a downloaded movie in the database matching %s, exiting!" % inputName,
section) section)
return [1, "%s: Failed to post-process - Failed download not found in %s" % (section, section) ] return [1, "%s: Failed to post-process - Failed download not found in %s" % (section, section) ]
logger.postprocess("Setting failed release %s to ignored ..." % (inputName), section) if release_id:
logger.postprocess("Setting failed release %s to ignored ..." % (inputName), section)
url = baseURL + "/release.ignore" url = baseURL + "/release.ignore"
params = {'id': release_id} params = {'id': release_id}
logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section) logger.debug("Opening URL: %s with PARAMS: %s" % (url, params), section)
try: try:
r = requests.get(url, params=params, verify=False) r = requests.get(url, params=params, verify=False)
except requests.ConnectionError: except requests.ConnectionError:
logger.error("Unable to open URL %s" % (url), section) logger.error("Unable to open URL %s" % (url), section)
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section) ] return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section) ]
result = r.json() result = r.json()
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code)) ] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code)) ]
elif result['success']: elif result['success']:
logger.postprocess("SUCCESS: %s has been set to ignored ..." % (inputName), section) logger.postprocess("SUCCESS: %s has been set to ignored ..." % (inputName), section)
else: else:
logger.warning("FAILED: Unable to set %s to ignored!" % (inputName), section) logger.warning("FAILED: Unable to set %s to ignored!" % (inputName), section)
return [1, "%s: Failed to post-process - Unable to set %s to ignored" % (section, inputName) ] return [1, "%s: Failed to post-process - Unable to set %s to ignored" % (section, inputName) ]
logger.postprocess("Trying to snatch the next highest ranked release.", section) logger.postprocess("Trying to snatch the next highest ranked release.", section)