From: Marcel van der Veldt Date: Mon, 24 Feb 2025 13:14:41 +0000 (+0100) Subject: Fix: jsonrpc endpoint for slimproto devices X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=2d9fc7880f5c36cf91c98558a7ea06bf438a3558;p=music-assistant-server.git Fix: jsonrpc endpoint for slimproto devices --- diff --git a/music_assistant/providers/slimproto/__init__.py b/music_assistant/providers/slimproto/__init__.py index 3818bc01..b44a5bfe 100644 --- a/music_assistant/providers/slimproto/__init__.py +++ b/music_assistant/providers/slimproto/__init__.py @@ -265,10 +265,18 @@ class SlimprotoProvider(PlayerProvider): self.mass.streams.register_dynamic_route( "/slimproto/multi", self._serve_multi_client_stream ) + # it seems that WiiM devices do not use the json rpc port that is broadcasted + # in the discovery info but instead they just assume that the jsonrpc endpoint + # lives on the same server as stream URL. So we need to provide a jsonrpc.js + # endpoint that just redirects to the jsonrpc handler within the slimproto package. + self.mass.streams.register_dynamic_route( + "/jsonrpc.js", self.slimproto.cli._handle_jsonrpc_client + ) async def unload(self, is_removed: bool = False) -> None: """Handle close/cleanup of the provider.""" self.mass.streams.unregister_dynamic_route("/slimproto/multi") + self.mass.streams.unregister_dynamic_route("/jsonrpc.js") await self.slimproto.stop() async def get_player_config_entries(self, player_id: str) -> tuple[ConfigEntry]: