From 23d9f0cb2fc52203c640bc01a606bac04d39fedd Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 3 Nov 2025 01:08:41 +0100 Subject: [PATCH] Add a bit of diagnostic info to troubleshoot the Sonos issue of playback stopping --- music_assistant/controllers/streams.py | 26 ++++++++++++++--------- music_assistant/providers/sonos/player.py | 8 +++++-- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/music_assistant/controllers/streams.py b/music_assistant/controllers/streams.py index e9ff65ec..fb339d08 100644 --- a/music_assistant/controllers/streams.py +++ b/music_assistant/controllers/streams.py @@ -1576,16 +1576,22 @@ class StreamsController(CoreController): def _log_request(self, request: web.Request) -> None: """Log request.""" - if not self.logger.isEnabledFor(VERBOSE_LOG_LEVEL): - return - self.logger.log( - VERBOSE_LOG_LEVEL, - "Got %s request to %s from %s\nheaders: %s\n", - request.method, - request.path, - request.remote, - request.headers, - ) + if self.logger.isEnabledFor(VERBOSE_LOG_LEVEL): + self.logger.log( + VERBOSE_LOG_LEVEL, + "Got %s request to %s from %s\nheaders: %s\n", + request.method, + request.path, + request.remote, + request.headers, + ) + else: + self.logger.debug( + "Got %s request to %s from %s", + request.method, + request.path, + request.remote, + ) async def get_output_format( self, diff --git a/music_assistant/providers/sonos/player.py b/music_assistant/providers/sonos/player.py index a5bade0a..c1c8f08c 100644 --- a/music_assistant/providers/sonos/player.py +++ b/music_assistant/providers/sonos/player.py @@ -34,7 +34,7 @@ from music_assistant_models.errors import PlayerCommandFailed from music_assistant_models.player import PlayerMedia from music_assistant.constants import ( - CONF_ENTRY_HTTP_PROFILE_DEFAULT_1, + CONF_ENTRY_HTTP_PROFILE_DEFAULT_2, CONF_ENTRY_OUTPUT_CODEC, create_sample_rates_config_entry, ) @@ -235,7 +235,7 @@ class SonosPlayer(Player): base_entries = [ *await super().get_config_entries(action=action, values=values), CONF_ENTRY_OUTPUT_CODEC, - CONF_ENTRY_HTTP_PROFILE_DEFAULT_1, + CONF_ENTRY_HTTP_PROFILE_DEFAULT_2, create_sample_rates_config_entry( # set safe max bit depth to 16 bits because the older Sonos players # do not support 24 bit playback (e.g. Play:1) @@ -491,6 +491,10 @@ class SonosPlayer(Player): """ current_item_id = self.current_media.queue_item_id if self.current_media else None self.sonos_queue.enqueue_next(current_item_id, media) + self.logger.debug(f"Enqueued next media item: {media.title}") + self.logger.debug( + "Current Sonos queue items: %s", [x.title for x in self.sonos_queue.items] + ) if session_id := self.client.player.group.active_session_id: await self.client.api.playback_session.refresh_cloud_queue(session_id) -- 2.34.1