From a737a651ec0c7790f6514cf84c5ed56ca4616a0c Mon Sep 17 00:00:00 2001 From: Simone Tesini Date: Sat, 2 Aug 2025 03:18:30 +0200 Subject: [PATCH] add socket events for various backend pioints --- backend/src/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/app.py b/backend/src/app.py index a99444c..304ab3c 100644 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -112,9 +112,10 @@ def queue_next(): ## queue ended # room.renew_queue() - state.socketio.emit("update_queue", {"songs": room.playing}, to=str(room.id)) + data = {"success": True, "ended": True, "index": room.playing_idx, "queue": room.playing} + state.socketio.emit("new_queue", data, to=str(room.id)) - return {"success": True, "ended": True, "index": room.playing_idx, "queue": room.playing} + return data return {"success": True, "ended": False, "index": room.playing_idx} @@ -202,6 +203,7 @@ def add_song(): ## add the song in the room if does not exists if song.uuid not in room.songs: room.songs[song.uuid] = (song, 1) # start with one vote + socketio.emit("new_song", {"song": song, "user_score": 1}, to=str(room.id)) return {"success": True, "song": song} @@ -233,6 +235,7 @@ def post_song_vote(): ## update the song room.songs[song_id] = (song_info[0], song_info[1] + int(request.args["increment"])) + socketio.emit("new_vote", {"song": song_info[0], "user_score": song_info[1]}) return {"success": True}