Subsonic: Add debug level logging around stream start, end, and details (#1523)
authorEric Munson <eric@munsonfam.org>
Mon, 29 Jul 2024 10:29:30 +0000 (06:29 -0400)
committerGitHub <noreply@github.com>
Mon, 29 Jul 2024 10:29:30 +0000 (12:29 +0200)
music_assistant/server/providers/opensubsonic/sonic_provider.py

index cff871c2028d0fabc31b2e88989319129bc31fa5..a152b96300862c49a658307d6f78bf41b53e2b6d 100644 (file)
@@ -792,6 +792,13 @@ class OpenSonicProvider(MusicProvider):
         if mime_type.endswith("mpeg"):
             mime_type = sonic_song.suffix
 
+        self.logger.debug(
+            "Fetching stream details for id %s '%s' with format '%s'",
+            sonic_song.id,
+            sonic_song.title,
+            mime_type,
+        )
+
         return StreamDetails(
             item_id=sonic_song.id,
             provider=self.instance_id,
@@ -815,6 +822,8 @@ class OpenSonicProvider(MusicProvider):
         """Provide a generator for the stream data."""
         audio_buffer = asyncio.Queue(1)
 
+        self.logger.debug("Streaming %s", streamdetails.item_id)
+
         def _streamer() -> None:
             with self._conn.stream(
                 streamdetails.item_id, timeOffset=seek_position, estimateContentLength=True
@@ -838,3 +847,5 @@ class OpenSonicProvider(MusicProvider):
         finally:
             if not streamer_task.done():
                 streamer_task.cancel()
+
+        self.logger.debug("Done streaming %s", streamdetails.item_id)