0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 13:52:00 +01:00

imc stuff

This commit is contained in:
2025-12-14 10:59:13 +01:00
parent 6c3a96cf63
commit decb38ce91
2 changed files with 13 additions and 20 deletions

View File

@@ -6,7 +6,7 @@ import asyncio
import websockets
from websockets import ServerConnection, Request, Response, Headers
from . import Track, PlayerModule, Path
from . import Track, PlayerModule, Path, BaseIMCModule
MAIN_PATH_DIR = Path("/home/user/mixes")
@@ -32,7 +32,7 @@ async def ws_handler(websocket: ServerConnection, shared_data: dict, imc_q: mult
imc_q.put({"name": name, "data": data, "key": key})
start = time.monotonic()
result = None
while time.monotonic() - start < 2:
while time.monotonic() - start < 1.5:
if key in shared_data:
result = shared_data.pop(key)
break
@@ -216,6 +216,10 @@ class Module(PlayerModule):
self.data["progress"] = json.dumps(payload)
try: self.ws_q.put({"event": "progress", "data": payload})
except Exception: pass
def imc_data(self, source: BaseIMCModule, source_name: str | None, data: object, broadcast: bool) -> object:
try: self.ws_q.put({"event": "imc", "data": {"name": source_name, "data": data, "broadcast": broadcast}})
except Exception: pass
def shutdown(self):
self.ipc_thread_running = False