mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Use format()
instead of %
for string formatting
This commit is contained in:
parent
0c45961382
commit
51d2c73054
5 changed files with 148 additions and 148 deletions
|
@ -14,7 +14,7 @@ class autoProcessComics(object):
|
|||
def processEpisode(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
|
||||
if int(status) != 0:
|
||||
logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.", section)
|
||||
return [1, "%s: Failed to post-process. %s does not support failed downloads" % (section, section)]
|
||||
return [1, "{0}: Failed to post-process. {1} does not support failed downloads".format(section, section)]
|
||||
|
||||
host = core.CFG[section][inputCategory]["host"]
|
||||
port = core.CFG[section][inputCategory]["port"]
|
||||
|
@ -25,10 +25,10 @@ class autoProcessComics(object):
|
|||
remote_path = int(core.CFG[section][inputCategory].get("remote_path"), 0)
|
||||
protocol = "https://" if ssl else "http://"
|
||||
|
||||
url = "%s%s:%s%s/post_process" % (protocol, host, port, web_root)
|
||||
url = "{0}{1}:{2}{3}/post_process".format(protocol, host, port, web_root)
|
||||
if not server_responding(url):
|
||||
logger.error("Server did not respond. Exiting", section)
|
||||
return [1, "%s: Failed to post-process - %s did not respond." % (section, section)]
|
||||
return [1, "{0}: Failed to post-process - {1} did not respond.".format(section, section)]
|
||||
|
||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||
clean_name, ext = os.path.splitext(inputName)
|
||||
|
@ -44,25 +44,25 @@ class autoProcessComics(object):
|
|||
|
||||
success = False
|
||||
|
||||
logger.debug("Opening URL: %s" % (url), section)
|
||||
logger.debug("Opening URL: {0}".format(url), section)
|
||||
try:
|
||||
r = requests.get(url, auth=(username, password), params=params, stream=True, verify=False, timeout=(30, 300))
|
||||
except requests.ConnectionError:
|
||||
logger.error("Unable to open URL", section)
|
||||
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)]
|
||||
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
|
||||
for line in r.iter_lines():
|
||||
if line:
|
||||
logger.postprocess("%s" % (line), section)
|
||||
logger.postprocess("{0}".format(line), section)
|
||||
if "Post Processing SUCCESSFUL" in line:
|
||||
success = True
|
||||
|
||||
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
|
||||
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))]
|
||||
logger.error("Server returned status {0}".format(r.status_code), section)
|
||||
return [1, "{0}: Failed to post-process - Server returned status {1}".format(section, r.status_code)]
|
||||
|
||||
if success:
|
||||
logger.postprocess("SUCCESS: This issue has been processed successfully", section)
|
||||
return [0, "%s: Successfully post-processed %s" % (section, inputName)]
|
||||
return [0, "{0}: Successfully post-processed {1}".format(section, inputName)]
|
||||
else:
|
||||
logger.warning("The issue does not appear to have successfully processed. Please check your Logs", section)
|
||||
return [1, "%s: Failed to post-process - Returned log from %s was not as expected." % (section, section)]
|
||||
return [1, "{0}: Failed to post-process - Returned log from {1} was not as expected.".format(section, section)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue