add socket events for various backend pioints
This commit is contained in:
parent
a5b1943030
commit
a737a651ec
1 changed files with 5 additions and 2 deletions
|
@ -112,9 +112,10 @@ def queue_next():
|
||||||
## queue ended
|
## queue ended
|
||||||
|
|
||||||
# room.renew_queue()
|
# 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}
|
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
|
## add the song in the room if does not exists
|
||||||
if song.uuid not in room.songs:
|
if song.uuid not in room.songs:
|
||||||
room.songs[song.uuid] = (song, 1) # start with one vote
|
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}
|
return {"success": True, "song": song}
|
||||||
|
|
||||||
|
@ -233,6 +235,7 @@ def post_song_vote():
|
||||||
|
|
||||||
## update the song
|
## update the song
|
||||||
room.songs[song_id] = (song_info[0], song_info[1] + int(request.args["increment"]))
|
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}
|
return {"success": True}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue