cleanup
This commit is contained in:
parent
59dfbbeca9
commit
9c85ecbfaf
1 changed files with 2 additions and 15 deletions
|
@ -1,9 +1,7 @@
|
|||
from typing import Any
|
||||
|
||||
import dotenv
|
||||
from flask import Flask, Response, jsonify, request
|
||||
from flask_cors import CORS
|
||||
from flask_socketio import SocketIO, emit, join_room, leave_room
|
||||
from flask_socketio import SocketIO, join_room, leave_room
|
||||
|
||||
from .connect import get_connection
|
||||
from .qrcode_gen import generate_qr
|
||||
|
@ -44,17 +42,6 @@ def error(msg: str, status: int = 400) -> Response:
|
|||
return res
|
||||
|
||||
|
||||
def ws_broadcast(event: str, *, room_id: int | None = None, data: Any) -> None:
|
||||
final = {}
|
||||
|
||||
if room_id is not None:
|
||||
final["room_id"] = room_id
|
||||
|
||||
final["data"] = data
|
||||
|
||||
emit(event, final, broadcast=True, namespace="/")
|
||||
|
||||
|
||||
@socketio.on("connect")
|
||||
def handle_connection():
|
||||
print("somebody connected to socket.io", flush=True)
|
||||
|
@ -121,7 +108,7 @@ def queue_next():
|
|||
## queue ended
|
||||
|
||||
# room.renew_queue()
|
||||
emit("update_songs", {"songs": [1, 2, 3]}, broadcast=True, namespace="/")
|
||||
state.socketio.emit("update_queue", {"songs": room.playing}, to=str(room.id))
|
||||
|
||||
return {"success": True, "ended": True, "index": room.playing_idx, "queue": room.playing}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue