octoprint_compat: respect OctoPrint's case

Make sure that the "P" in Print is capitalized when referencing
OctoPrint.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-02-26 08:44:35 -05:00
parent 65e76aeec8
commit 8f7f824a47
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A
1 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# Octoprint API compatibility # OctoPrint API compatibility
# #
# Copyright (C) 2021 Nickolas Grigoriadis <nagrigoriadis@gmail.com> # Copyright (C) 2021 Nickolas Grigoriadis <nagrigoriadis@gmail.com>
# #
@ -24,12 +24,12 @@ if TYPE_CHECKING:
OCTO_VERSION = '1.5.0' OCTO_VERSION = '1.5.0'
class OctoprintCompat: class OctoPrintCompat:
""" """
Minimal implementation of the REST API as described here: Minimal implementation of the REST API as described here:
https://docs.octoprint.org/en/master/api/index.html https://docs.octoprint.org/en/master/api/index.html
So that Cura Octoprint plugin will function for: So that Cura OctoPrint plugin will function for:
* Handshake * Handshake
* Upload gcode/ufp * Upload gcode/ufp
* Webcam config * Webcam config
@ -224,7 +224,7 @@ class OctoprintCompat:
web_request: WebRequest web_request: WebRequest
) -> Dict[str, Any]: ) -> Dict[str, Any]:
""" """
Used to parse Octoprint capabilities Used to parse OctoPrint capabilities
""" """
settings = { settings = {
'plugins': {}, 'plugins': {},
@ -382,19 +382,19 @@ class OctoprintCompat:
except self.server.error: except self.server.error:
started = False started = False
else: else:
logging.debug(f"Job '{filename}' started via Octoprint API") logging.debug(f"Job '{filename}' started via OctoPrint API")
started = True started = True
if not started: if not started:
if fmgr.upload_queue_enabled(): if fmgr.upload_queue_enabled():
job_queue: JobQueue = self.server.lookup_component( job_queue: JobQueue = self.server.lookup_component(
'job_queue') 'job_queue')
await job_queue.queue_job(filename, check_exists=False) await job_queue.queue_job(filename, check_exists=False)
logging.debug(f"Job '{filename}' queued via Octoprint API") logging.debug(f"Job '{filename}' queued via OctoPrint API")
else: else:
raise self.server.error("Conflict", 409) raise self.server.error("Conflict", 409)
else: else:
raise self.server.error(f"Unsupported Command: {command}") raise self.server.error(f"Unsupported Command: {command}")
def load_component(config: ConfigHelper) -> OctoprintCompat: def load_component(config: ConfigHelper) -> OctoPrintCompat:
return OctoprintCompat(config) return OctoPrintCompat(config)