add socket events for various backend pioints

This commit is contained in:
Simone Tesini 2025-08-02 03:18:30 +02:00
parent a5b1943030
commit a737a651ec

View file

@ -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}