From 02a04eaacb73cebee1254cb6cf5be803e40ec172 Mon Sep 17 00:00:00 2001 From: 3ll3d00d Date: Sat, 13 Jan 2024 19:00:55 +0000 Subject: [PATCH] allow mcws to be optional --- cmdserver/main.py | 10 +++++++--- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmdserver/main.py b/cmdserver/main.py index c6a8ca5..e461b59 100644 --- a/cmdserver/main.py +++ b/cmdserver/main.py @@ -30,7 +30,9 @@ def create_app(cfg: Config) -> Tuple[Flask, 'WsServer']: mqtt = None if cfg.mqtt: mqtt = MQTT(cfg.mqtt['ip'], cfg.mqtt.get('port', 1883), cfg.mqtt.get('user', None), cfg.mqtt.get('cred', None)) - info_provider = InfoProvider(cfg, ws_server, mqtt) + info_provider = None + if cfg.mcws: + info_provider = InfoProvider(cfg, ws_server, mqtt) resource_args = { 'command_controller': CommandController(cfg), 'tivoController': TivoController(cfg, mqtt), @@ -51,13 +53,15 @@ def decorate_ns(ns, p=None): decorate_ns(commands.api) decorate_ns(command.api) - decorate_ns(playingnow.api) + if info_provider: + decorate_ns(playingnow.api) decorate_ns(tivos.api) decorate_ns(tivo.api) decorate_ns(info.api) decorate_ns(pj.api) decorate_ns(version.api) - decorate_ns(wake.api) + if info_provider: + decorate_ns(wake.api) return app, ws_server diff --git a/pyproject.toml b/pyproject.toml index d9029a8..2bd90be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ezmote-cmdserver" -version = "1.1.18" +version = "1.1.19" description = "A small webapp which can be used for web based home cinema automation" authors = ["3ll3d00d "] license = "MIT"