From 9153c3b1c68536b60b884f24c0450c12930f2f67 Mon Sep 17 00:00:00 2001 From: ION606 Date: Fri, 12 Sep 2025 10:01:18 -0400 Subject: [PATCH] added catch for no roku ip --- docker-compose.yml | 2 +- tools/rokuHandler.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 65b93f0..a637037 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ services: context: ./tools dockerfile: Dockerfile env_file: .env - restart: unless-stopped + restart: on-failure networks: - internal diff --git a/tools/rokuHandler.py b/tools/rokuHandler.py index 306a2da..f38874d 100644 --- a/tools/rokuHandler.py +++ b/tools/rokuHandler.py @@ -5,7 +5,7 @@ import threading ROKU_IP = os.environ.get("ROKU_IP") if not ROKU_IP: - raise Exception("Roku IP not found in env!") + print("Roku IP not found in env!") COMMANDS = { # Standard Keys @@ -69,6 +69,9 @@ class RokuWrapper(): return self._send_msg(500, {"error": "roku connection failed"}) def run_command(self, command: str): + if not ROKU_IP: + return self._send_msg(500, {"error": "Roku IP not found in env! Do not attempt further Roku requests"}) + if not command: return self._send_msg(404, {"error": "command not given"}) command = command.split('/')[0]