Find the current song's URL and pass it on when possible

This commit is contained in:
Danielle McLean 2024-07-23 13:29:50 +10:00
parent b8bcdc5a83
commit d9c8e0fe28
Signed by: 00dani
GPG key ID: 6854781A0488421C
9 changed files with 79 additions and 21 deletions

View file

@ -3,6 +3,7 @@ from pathlib import Path
import ormsgpack
from websockets import broadcast
from websockets.server import WebSocketServerProtocol, serve
from yarl import URL
from ...config.model import WebsocketsReceiverConfig
from ...player import Player
@ -15,6 +16,8 @@ MSGPACK_NULL = ormsgpack.packb(None)
def default(value: object) -> object:
if isinstance(value, Path):
return str(value)
if isinstance(value, URL):
return value.human_repr()
raise TypeError