octoprint_compat: add webcam settings

Signed-off-by: Simon Germain <sgermain06@gmail.com>
This commit is contained in:
Simon Germain
2022-02-17 10:46:05 -05:00
committed by GitHub
parent f79439aedd
commit 11f4ae75cc
4 changed files with 45 additions and 12 deletions

View File

@@ -43,6 +43,15 @@ class OctoprintCompat:
'software_version')
self.enable_ufp: bool = config.getboolean('enable_ufp', True)
# Get webcam settings from config
self.webcam: Dict[str, Any] = {
'flipH': config.getboolean('flip_h', False),
'flipV': config.getboolean('flip_v', False),
'rotate90': config.getboolean('rotate_90', False),
'streamUrl': config.get('stream_url', '/webcam/?action=stream'),
'webcamEnabled': config.getboolean('webcam_enabled', True),
}
# Local variables
self.klippy_apis: APIComp = self.server.lookup_component('klippy_apis')
self.heaters: Dict[str, Dict[str, Any]] = {}
@@ -216,9 +225,6 @@ class OctoprintCompat:
) -> Dict[str, Any]:
"""
Used to parse Octoprint capabilities
Hardcode capabilities to be basically there and use default
fluid/mainsail webcam path.
"""
settings = {
'plugins': {},
@@ -226,15 +232,7 @@ class OctoprintCompat:
'sdSupport': False,
'temperatureGraph': False
},
# TODO: Get webcam settings from config file to allow user
# to customise this.
'webcam': {
'flipH': False,
'flipV': False,
'rotate90': False,
'streamUrl': '/webcam/?action=stream',
'webcamEnabled': True,
},
'webcam': self.webcam,
}
if self.enable_ufp:
settings['plugins'] = {