added catch for no roku ip
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ services:
|
|||||||
context: ./tools
|
context: ./tools
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
env_file: .env
|
env_file: .env
|
||||||
restart: unless-stopped
|
restart: on-failure
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import threading
|
|||||||
|
|
||||||
ROKU_IP = os.environ.get("ROKU_IP")
|
ROKU_IP = os.environ.get("ROKU_IP")
|
||||||
if not ROKU_IP:
|
if not ROKU_IP:
|
||||||
raise Exception("Roku IP not found in env!")
|
print("Roku IP not found in env!")
|
||||||
|
|
||||||
COMMANDS = {
|
COMMANDS = {
|
||||||
# Standard Keys
|
# Standard Keys
|
||||||
@@ -69,6 +69,9 @@ class RokuWrapper():
|
|||||||
return self._send_msg(500, {"error": "roku connection failed"})
|
return self._send_msg(500, {"error": "roku connection failed"})
|
||||||
|
|
||||||
def run_command(self, command: str):
|
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:
|
if not command:
|
||||||
return self._send_msg(404, {"error": "command not given"})
|
return self._send_msg(404, {"error": "command not given"})
|
||||||
command = command.split('/')[0]
|
command = command.split('/')[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user