From 9536bf7c075568cbe6d91402d4135e221eedf1dc Mon Sep 17 00:00:00 2001 From: michael-grace Date: Sun, 15 Nov 2020 20:53:34 +0000 Subject: [PATCH] adding to showplan --- websocket_server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/websocket_server.py b/websocket_server.py index c5f1815..bc132a4 100644 --- a/websocket_server.py +++ b/websocket_server.py @@ -30,13 +30,16 @@ async def websocket_handler(websocket, path): elif data["command"] == "LOAD": channel_to_q[channel].put("LOAD:" + str(data["weight"])) elif data["command"] == "ADD": + print(data) new_item: Dict[str, any] = { - "channel_weight": int(data["weight"]), + "channel_weight": int(data["newItem"]["weight"]), "filename": "dev\\test.mp3", - "title": data["title"], - "artist": None + "title": data["newItem"]["title"], + "artist": data["newItem"]["artist"] if "artist" in data["newItem"].keys() else None } channel_to_q[channel].put("ADD:" + json.dumps(new_item)) + elif data["command"] == "REMOVE": + channel_to_q[channel].put("REMOVE:" + str(data["weight"])) await asyncio.wait([conn.send(message) for conn in baps_clients])