Add ProcessResult to auto_process.common

This commit is contained in:
Labrys of Knossos 2018-12-29 07:20:45 -05:00
commit 69446930c3
3 changed files with 226 additions and 61 deletions

View file

@ -8,7 +8,7 @@ import requests
import core
from core import logger, transcoder
from core.auto_process.common import command_complete, completed_download_handling
from core.auto_process.common import command_complete, completed_download_handling, ProcessResult
from core.scene_exceptions import process_all_exceptions
from core.utils import convert_to_ascii, find_download, find_imdbid, import_subs, list_media_files, remote_dir, remove_dir, report_nzb, server_responding
@ -61,7 +61,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
release = None
else:
logger.error("Server did not respond. Exiting", section)
return [1, "{0}: Failed to post-process - {1} did not respond.".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - {0} did not respond.".format(section),
status_code=1,
)
# pull info from release found if available
release_id = None
@ -117,7 +120,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
status = 1
elif client_agent == "manual":
logger.warning("No media files found in directory {0} to manually process.".format(dir_name), section)
return [0, ""] # Success (as far as this script is concerned)
return ProcessResult(
message="",
status_code=0, # Success (as far as this script is concerned)
)
else:
logger.warning("No media files found in directory {0}. Processing this as a failed download".format(dir_name), section)
status = 1
@ -138,7 +144,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
core.rchmod(dir_name, chmod_directory)
else:
logger.error("Transcoding failed for files in {0}".format(dir_name), section)
return [1, "{0}: Failed to post-process - Transcoding failed".format(section)]
return ProcessResult(
message="{0}: Failed to post-process - Transcoding failed".format(section),
status_code=1,
)
for video in list_media_files(dir_name, media=True, audio=False, meta=False, archives=False):
if not release and ".cp(tt" not in video and imdbid:
video_name, video_ext = os.path.splitext(video)
@ -149,7 +158,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
if not apikey: # If only using Transcoder functions, exit here.
logger.info('No CouchPotato or Radarr apikey entered. Processing completed.')
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
params = {}
if download_id and release_id:
@ -183,16 +195,25 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
r = requests.post(base_url, data=json.dumps(payload), headers=headers, stream=True, verify=False, timeout=(30, 1800))
except requests.ConnectionError:
logger.error("Unable to open URL", section)
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to connect to {0}".format(section),
status_code=1,
)
result = r.json()
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
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)]
return ProcessResult(
message="{0}: Failed to post-process - Server returned status {1}".format(section, r.status_code),
status_code=1,
)
elif section == "CouchPotato" and result['success']:
logger.postprocess("SUCCESS: Finished {0} scan for folder {1}".format(method, dir_name), section)
if method == "manage":
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
elif section == "Radarr":
logger.postprocess("Radarr response: {0}".format(result['state']))
try:
@ -206,8 +227,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
else:
logger.error("FAILED: {0} scan was unable to finish for folder {1}. exiting!".format(method, dir_name),
section)
return [1, "{0}: Failed to post-process - Server did not return success".format(section)]
return ProcessResult(
message="{0}: Failed to post-process - Server did not return success".format(section),
status_code=1,
)
else:
core.FAILED = True
logger.postprocess("FAILED DOWNLOAD DETECTED FOR {0}".format(input_name), section)
@ -216,7 +239,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
if section == "Radarr":
logger.postprocess("FAILED: The download failed. Sending failed download to {0} for CDH processing".format(section), section)
return [1, "{0}: Download Failed. Sending back to {1}".format(section, section)] # Return as failed to flag this in the downloader.
return ProcessResult(
message="{0}: Download Failed. Sending back to {0}".format(section),
status_code=1, # Return as failed to flag this in the downloader.
)
if delete_failed and os.path.isdir(dir_name) and not os.path.dirname(dir_name) == dir_name:
logger.postprocess("Deleting failed files and folder {0}".format(dir_name), section)
@ -225,7 +251,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
if not release_id and not media_id:
logger.error("Could not find a downloaded movie in the database matching {0}, exiting!".format(input_name),
section)
return [1, "{0}: Failed to post-process - Failed download not found in {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Failed download not found in {0}".format(section),
status_code=1,
)
if release_id:
logger.postprocess("Setting failed release {0} to ignored ...".format(input_name), section)
@ -239,17 +268,26 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
r = requests.get(url, params=params, verify=False, timeout=(30, 120))
except requests.ConnectionError:
logger.error("Unable to open URL {0}".format(url), section)
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to connect to {1}".format(section),
status_code=1,
)
result = r.json()
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
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)]
return ProcessResult(
status_code=1,
message="{0}: Failed to post-process - Server returned status {1}".format(section, r.status_code),
)
elif result['success']:
logger.postprocess("SUCCESS: {0} has been set to ignored ...".format(input_name), section)
else:
logger.warning("FAILED: Unable to set {0} to ignored!".format(input_name), section)
return [1, "{0}: Failed to post-process - Unable to set {1} to ignored".format(section, input_name)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to set {1} to ignored".format(section, input_name),
status_code=1,
)
logger.postprocess("Trying to snatch the next highest ranked release.", section)
@ -260,18 +298,30 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
r = requests.get(url, params={'media_id': media_id}, verify=False, timeout=(30, 600))
except requests.ConnectionError:
logger.error("Unable to open URL {0}".format(url), section)
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to connect to {0}".format(section),
status_code=1,
)
result = r.json()
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
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)]
return ProcessResult(
message="{0}: Failed to post-process - Server returned status {1}".format(section, r.status_code),
status_code=1,
)
elif result['success']:
logger.postprocess("SUCCESS: Snatched the next highest release ...", section)
return [0, "{0}: Successfully snatched next highest release".format(section)]
return ProcessResult(
message="{0}: Successfully snatched next highest release".format(section),
status_code=0,
)
else:
logger.postprocess("SUCCESS: Unable to find a new release to snatch now. CP will keep searching!", section)
return [0, "{0}: No new release found now. {1} will keep searching".format(section, section)]
return ProcessResult(
status_code=0,
message="{0}: No new release found now. {0} will keep searching".format(section),
)
# Added a release that was not in the wanted list so confirm rename successful by finding this movie media.list.
if not release:
@ -294,12 +344,18 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
if release_status_old is None: # we didn't have a release before, but now we do.
logger.postprocess("SUCCESS: Movie {0} has now been added to CouchPotato with release status of [{1}]".format(
title, str(release_status_new).upper()), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
if release_status_new != release_status_old:
logger.postprocess("SUCCESS: Release for {0} has now been marked with a status of [{1}]".format(
title, str(release_status_new).upper()), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
except Exception:
pass
elif scan_id:
@ -312,17 +368,26 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
elif command_status in ['failed']:
logger.debug("The Scan command has failed. Renaming was not successful.", section)
# return [1, "%s: Failed to post-process %s" % (section, input_name) ]
# return ProcessResult(
# message="{0}: Failed to post-process {1}".format(section, input_name),
# status_code=1,
# )
if not os.path.isdir(dir_name):
logger.postprocess("SUCCESS: Input Directory [{0}] has been processed and removed".format(
dir_name), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
status_code=0,
message="{0}: Successfully post-processed {1}".format(section, input_name),
)
elif not list_media_files(dir_name, media=True, audio=False, meta=False, archives=True):
logger.postprocess("SUCCESS: Input Directory [{0}] has no remaining media files. This has been fully processed.".format(
dir_name), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
# pause and let CouchPotatoServer/Radarr catch its breath
time.sleep(10 * wait_for)
@ -330,11 +395,18 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
# The status hasn't changed. we have waited wait_for minutes which is more than enough. uTorrent can resume seeding now.
if section == "Radarr" and completed_download_handling(url2, headers, section=section):
logger.debug("The Scan command did not return status completed, but complete Download Handling is enabled. Passing back to {0}.".format(section), section)
return [status, "{0}: Complete DownLoad Handling is enabled. Passing back to {1}".format(section, section)]
return ProcessResult(
message="{0}: Complete DownLoad Handling is enabled. Passing back to {0}".format(section),
status_code=status,
)
logger.warning(
"{0} does not appear to have changed status after {1} minutes, Please check your logs.".format(input_name, wait_for),
section)
return [1, "{0}: Failed to post-process - No change in status".format(section)]
section,
)
return ProcessResult(
status_code=1,
message="{0}: Failed to post-process - No change in status".format(section),
)
def get_release(base_url, imdb_id=None, download_id=None, release_id=None):

View file

@ -8,7 +8,7 @@ import requests
import core
from core import logger
from core.auto_process.common import command_complete
from core.auto_process.common import command_complete, ProcessResult
from core.scene_exceptions import process_all_exceptions
from core.utils import convert_to_ascii, list_media_files, remote_dir, remove_dir, server_responding
@ -41,7 +41,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
url = "{0}{1}:{2}{3}/api".format(protocol, host, port, web_root)
if not server_responding(url):
logger.error("Server did not respond. Exiting", section)
return [1, "{0}: Failed to post-process - {1} did not respond.".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - {0} did not respond.".format(section),
status_code=1,
)
if not os.path.isdir(dir_name) and os.path.isfile(dir_name): # If the input directory is a file, assume single file download and split dir/name.
dir_name = os.path.split(os.path.normpath(dir_name))[0]
@ -84,12 +87,15 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
}
res = force_process(params, url, apikey, input_name, dir_name, section, wait_for)
if res[0] in [0, 1]:
if res.status_code in [0, 1]:
return res
# The status hasn't changed. uTorrent can resume seeding now.
logger.warning("The music album does not appear to have changed status after {0} minutes. Please check your Logs".format(wait_for), section)
return [1, "{0}: Failed to post-process - No change in wanted status".format(section)]
return ProcessResult(
message="{0}: Failed to post-process - No change in wanted status".format(section),
status_code=1,
)
elif status == 0 and section == "Lidarr":
url = "{0}{1}:{2}{3}/api/v1/command".format(protocol, host, port, web_root)
@ -106,7 +112,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
r = requests.post(url, data=data, headers=headers, stream=True, verify=False, timeout=(30, 1800))
except requests.ConnectionError:
logger.error("Unable to open URL: {0}".format(url), section)
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to connect to {0}".format(section),
status_code=1,
)
success = False
queued = False
@ -120,7 +129,10 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
logger.warning("No scan id was returned due to: {0}".format(e), section)
scan_id = None
started = False
return [1, "{0}: Failed to post-process - Unable to start scan".format(section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to start scan".format(section),
status_code=1,
)
n = 0
params = {}
@ -135,27 +147,45 @@ def process(section, dir_name, input_name=None, status=0, client_agent="manual",
logger.debug("The Scan command return status: {0}".format(command_status), section)
if not os.path.exists(dir_name):
logger.debug("The directory {0} has been removed. Renaming was successful.".format(dir_name), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
elif command_status and command_status in ['completed']:
logger.debug("The Scan command has completed successfully. Renaming was successful.", section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
elif command_status and command_status in ['failed']:
logger.debug("The Scan command has failed. Renaming was not successful.", section)
# return [1, "%s: Failed to post-process %s" % (section, input_name) ]
# return ProcessResult(
# message="{0}: Failed to post-process {1}".format(section, input_name),
# status_code=1,
# )
else:
logger.debug("The Scan command did not return status completed. Passing back to {0} to attempt complete download handling.".format(section), section)
return [status, "{0}: Passing back to {1} to attempt Complete Download Handling".format(section, section)]
return ProcessResult(
message="{0}: Passing back to {0} to attempt Complete Download Handling".format(section),
status_code=status,
)
else:
if section == "Lidarr":
logger.postprocess("FAILED: The download failed. Sending failed download to {0} for CDH processing".format(section), section)
return [1, "{0}: Download Failed. Sending back to {1}".format(section, section)] # Return as failed to flag this in the downloader.
return ProcessResult(
message="{0}: Download Failed. Sending back to {0}".format(section),
status_code=1, # Return as failed to flag this in the downloader.
)
else:
logger.warning("FAILED DOWNLOAD DETECTED", section)
if delete_failed and os.path.isdir(dir_name) and not os.path.dirname(dir_name) == dir_name:
logger.postprocess("Deleting failed files and folder {0}".format(dir_name), section)
remove_dir(dir_name)
return [1, "{0}: Failed to post-process. {1} does not support failed downloads".format(section, section)] # Return as failed to flag this in the downloader.
return ProcessResult(
message="{0}: Failed to post-process. {0} does not support failed downloads".format(section),
status_code=1, # Return as failed to flag this in the downloader.
)
def get_status(url, apikey, dir_name):
@ -196,18 +226,27 @@ def force_process(params, url, apikey, input_name, dir_name, section, wait_for):
r = requests.get(url, params=params, verify=False, timeout=(30, 300))
except requests.ConnectionError:
logger.error("Unable to open URL {0}".format(url), section)
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to connect to {0}".format(section),
status_code=1,
)
logger.debug("Result: {0}".format(r.text), section)
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
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)]
return ProcessResult(
message="{0}: Failed to post-process - Server returned status {1}".format(section, r.status_code),
status_code=1,
)
elif r.text == "OK":
logger.postprocess("SUCCESS: Post-Processing started for {0} in folder {1} ...".format(input_name, dir_name), section)
else:
logger.error("FAILED: Post-Processing has NOT started for {0} in folder {1}. exiting!".format(input_name, dir_name), section)
return [1, "{0}: Failed to post-process - Returned log from {1} was not as expected.".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Returned log from {0} was not as expected.".format(section),
status_code=1,
)
# we will now wait for this album to be processed before returning to TorrentToMedia and unpausing.
timeout = time.time() + 60 * wait_for
@ -215,10 +254,19 @@ def force_process(params, url, apikey, input_name, dir_name, section, wait_for):
current_status = get_status(url, apikey, dir_name)
if current_status is not None and current_status != release_status: # Something has changed. CPS must have processed this movie.
logger.postprocess("SUCCESS: This release is now marked as status [{0}]".format(current_status), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
if not os.path.isdir(dir_name):
logger.postprocess("SUCCESS: The input directory {0} has been removed Processing must have finished.".format(dir_name), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
time.sleep(10 * wait_for)
# The status hasn't changed.
return [2, "no change"]
return ProcessResult(
message="no change",
status_code=2,
)

View file

@ -10,7 +10,7 @@ import requests
import core
from core import logger, transcoder
from core.auto_process.common import command_complete, completed_download_handling
from core.auto_process.common import command_complete, completed_download_handling, ProcessResult
from core.forks import auto_fork
from core.scene_exceptions import process_all_exceptions
from core.utils import convert_to_ascii, flatten, import_subs, list_media_files, remote_dir, remove_dir, report_nzb, server_responding
@ -39,7 +39,10 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
fork, fork_params = "None", {}
else:
logger.error("Server did not respond. Exiting", section)
return [1, "{0}: Failed to post-process - {1} did not respond.".format(section, section)]
return ProcessResult(
status_code=1,
message="{0}: Failed to post-process - {0} did not respond.".format(section),
)
delete_failed = int(cfg.get("delete_failed", 0))
nzb_extraction_by = cfg.get("nzbExtractionBy", "Downloader")
@ -117,7 +120,10 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
failure_link += '&corrupt=true'
elif client_agent == "manual":
logger.warning("No media files found in directory {0} to manually process.".format(dir_name), section)
return [0, ""] # Success (as far as this script is concerned)
return ProcessResult(
message="",
status_code=0, # Success (as far as this script is concerned)
)
elif nzb_extraction_by == "Destination":
logger.info("Check for media files ignored because nzbExtractionBy is set to Destination.")
if int(failed) == 0:
@ -148,7 +154,10 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
core.rchmod(dir_name, chmod_directory)
else:
logger.error("FAILED: Transcoding failed for files in {0}".format(dir_name), section)
return [1, "{0}: Failed to post-process - Transcoding failed".format(section)]
return ProcessResult(
message="{0}: Failed to post-process - Transcoding failed".format(section),
status_code=1,
)
# configure SB params to pass
fork_params['quiet'] = 1
@ -210,7 +219,10 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
if status == 0:
if section == "NzbDrone" and not apikey:
logger.info('No Sonarr apikey entered. Processing completed.')
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
logger.postprocess("SUCCESS: The download succeeded, sending a post-process request", section)
else:
core.FAILED = True
@ -220,13 +232,19 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
logger.postprocess("FAILED: The download failed. Sending 'failed' process request to {0} branch".format(fork), section)
elif section == "NzbDrone":
logger.postprocess("FAILED: The download failed. Sending failed download to {0} for CDH processing".format(fork), section)
return [1, "{0}: Download Failed. Sending back to {1}".format(section, section)] # Return as failed to flag this in the downloader.
return ProcessResult(
message="{0}: Download Failed. Sending back to {0}".format(section),
status_code=1, # Return as failed to flag this in the downloader.
)
else:
logger.postprocess("FAILED: The download failed. {0} branch does not handle failed downloads. Nothing to process".format(fork), section)
if delete_failed and os.path.isdir(dir_name) and not os.path.dirname(dir_name) == dir_name:
logger.postprocess("Deleting failed files and folder {0}".format(dir_name), section)
remove_dir(dir_name)
return [1, "{0}: Failed to post-process. {1} does not support failed downloads".format(section, section)] # Return as failed to flag this in the downloader.
return ProcessResult(
message="{0}: Failed to post-process. {0} does not support failed downloads".format(section),
status_code=1, # Return as failed to flag this in the downloader.
)
url = None
if section == "SickBeard":
@ -266,11 +284,17 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
r = requests.post(url, data=data, headers=headers, stream=True, verify=False, timeout=(30, 1800))
except requests.ConnectionError:
logger.error("Unable to open URL: {0}".format(url), section)
return [1, "{0}: Failed to post-process - Unable to connect to {1}".format(section, section)]
return ProcessResult(
message="{0}: Failed to post-process - Unable to connect to {0}".format(section),
status_code=1,
)
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
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)]
return ProcessResult(
message="{0}: Failed to post-process - Server returned status {1}".format(section, r.status_code),
status_code=1,
)
success = False
queued = False
@ -309,7 +333,10 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
remove_dir(dir_name)
if success:
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
elif section == "NzbDrone" and started:
n = 0
params = {}
@ -324,18 +351,36 @@ def process(section, dir_name, input_name=None, failed=False, client_agent="manu
logger.debug("The Scan command return status: {0}".format(command_status), section)
if not os.path.exists(dir_name):
logger.debug("The directory {0} has been removed. Renaming was successful.".format(dir_name), section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
elif command_status and command_status in ['completed']:
logger.debug("The Scan command has completed successfully. Renaming was successful.", section)
return [0, "{0}: Successfully post-processed {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Successfully post-processed {1}".format(section, input_name),
status_code=0,
)
elif command_status and command_status in ['failed']:
logger.debug("The Scan command has failed. Renaming was not successful.", section)
# return [1, "%s: Failed to post-process %s" % (section, input_name) ]
# return ProcessResult(
# message="{0}: Failed to post-process {1}".format(section, input_name),
# status_code=1,
# )
if completed_download_handling(url2, headers, section=section):
logger.debug("The Scan command did not return status completed, but complete Download Handling is enabled. Passing back to {0}.".format(section), section)
return [status, "{0}: Complete DownLoad Handling is enabled. Passing back to {1}".format(section, section)]
return ProcessResult(
message="{0}: Complete DownLoad Handling is enabled. Passing back to {0}".format(section),
status_code=status,
)
else:
logger.warning("The Scan command did not return a valid status. Renaming was not successful.", section)
return [1, "{0}: Failed to post-process {1}".format(section, input_name)]
return ProcessResult(
message="{0}: Failed to post-process {1}".format(section, input_name),
status_code=1,
)
else:
return [1, "{0}: Failed to post-process - Returned log from {1} was not as expected.".format(section, section)] # We did not receive Success confirmation.
return ProcessResult(
message="{0}: Failed to post-process - Returned log from {0} was not as expected.".format(section),
status_code=1, # We did not receive Success confirmation.
)