Compare commits

..

No commits in common. "1d1e94da851c8eb9bc94f85235179a4f091cd910" and "285deadf09c01ff546772934f2c2ec07456b13ff" have entirely different histories.

4 changed files with 2 additions and 43 deletions

View file

@ -160,7 +160,7 @@ class Client:
self.connection_state = ConnectionState()
self.set_log_level(config["config"]["log_level"])
self.sio = socketio.AsyncClient(json=jsonencoder, reconnection_attempts=-1)
self.sio = socketio.AsyncClient(json=jsonencoder)
self.loop: Optional[asyncio.AbstractEventLoop] = None
self.skipped: list[UUID] = []
self.sources = configure_sources(config["sources"])

View file

@ -120,20 +120,6 @@ class Queue:
return item
return None
def find_all_by_name(self, name: str) -> Iterable[Entry]:
"""
Find all entries by their performer and return them as an iterable.
:param name: The name of the performer to search for.
:type name: str
:returns: The entries with the performer.
:rtype: Iterable[Entry]
"""
for item in self._queue:
if item.shares_performer(name):
yield item
def find_by_uuid(self, uuid: UUID | str) -> Optional[Entry]:
"""
Find an entry by its uuid and return it.

View file

@ -682,33 +682,6 @@ class Server:
await self.sio.emit("play", current, room=sid)
@admin
@with_state
async def handle_queue_to_waiting_room(
self, state: State, sid: str, data: dict[str, Any]
) -> None:
"""
Handle the "queue-to-waiting" message.
If on an admin-connection, removes a song from the queue and appends it to
the waiting room. If the performer has only one entry in the queue, it is
put back into the queue immediately.
:param sid: The session id of the requesting client
:type sid: str
:rtype: None
"""
entry = state.queue.find_by_uuid(data["uuid"])
if entry is not None:
performer_entries = list(state.queue.find_all_by_name(entry.performer))
print(performer_entries)
if len(performer_entries) == 1:
return
await state.queue.remove(entry)
state.waiting_room.append(entry)
await self.broadcast_state(state, sid=sid)
@admin
@with_state
async def handle_waiting_room_to_queue(

View file

@ -36,7 +36,7 @@ class AsyncServer:
def instrument(self, auth: dict[str, str]) -> None: ...
class AsyncClient:
def __init__(self, json: Any = None, reconnection_attempts: int = 0): ...
def __init__(self, json: Any = None): ...
def on(
self, event: str, handler: Optional[Callable[..., Any]] = None
) -> Callable[[ClientHandler], ClientHandler]: ...