Update librespot binaries (#371)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 16 Jun 2022 16:17:23 +0000 (18:17 +0200)
committerGitHub <noreply@github.com>
Thu, 16 Jun 2022 16:17:23 +0000 (18:17 +0200)
* update librespot binaries

* add exception when streaming from spotify fails

* don't send analyze job if stream failed

music_assistant/helpers/audio.py
music_assistant/music_providers/librespot/linux/librespot-aarch64
music_assistant/music_providers/librespot/linux/librespot-armv7
music_assistant/music_providers/librespot/linux/librespot-x86_64
music_assistant/music_providers/librespot/osx/librespot
music_assistant/music_providers/spotify.py

index e70f7c8e712784901fa3bcd5cafcad8dd999e050..a9d7af0269e7add8a197744960b5ec36a376d5ca 100644 (file)
@@ -433,7 +433,11 @@ async def get_media_stream(
             )
         finally:
             # send analyze job to background worker
-            if streamdetails.loudness is None:
+            if (
+                streamdetails.loudness is None
+                and prev_chunk
+                and streamdetails.media_type in (MediaType.TRACK, MediaType.RADIO)
+            ):
                 mass.add_job(
                     analyze_audio(mass, streamdetails),
                     f"Analyze audio for {streamdetails.uri}",
index 5359098f6dab28cdfa35301702f33a384694c08d..5e42d14f574ee8cdbbd85a3efdbae1bb25dfa91a 100755 (executable)
Binary files a/music_assistant/music_providers/librespot/linux/librespot-aarch64 and b/music_assistant/music_providers/librespot/linux/librespot-aarch64 differ
index 0a792b2e1201ae7a734c59e60522e72f5e85ce41..1db6879f4fc4459ebbee55febddae75c27d1a261 100755 (executable)
Binary files a/music_assistant/music_providers/librespot/linux/librespot-armv7 and b/music_assistant/music_providers/librespot/linux/librespot-armv7 differ
index e025abdb92b98be527faf675483fe644d77c35ff..bbbbe9ce444f498ddc571dbc09af7b393e7a95d9 100755 (executable)
Binary files a/music_assistant/music_providers/librespot/linux/librespot-x86_64 and b/music_assistant/music_providers/librespot/linux/librespot-x86_64 differ
index c1b3754337819c9c6d8bb74e5756b074cbf19824..915bff888760668fbe8c5366cb29ec3a23d82888 100755 (executable)
Binary files a/music_assistant/music_providers/librespot/osx/librespot and b/music_assistant/music_providers/librespot/osx/librespot differ
index 56912c1ebd747ee976beb78fd3760ddbe6767340..31b4b8c4723380bf4b898c90a7c9ba5f94cd002b 100644 (file)
@@ -20,7 +20,7 @@ from music_assistant.helpers.cache import use_cache
 from music_assistant.helpers.process import AsyncProcess
 from music_assistant.helpers.util import parse_title_and_version
 from music_assistant.models.enums import ProviderType
-from music_assistant.models.errors import LoginFailed, MediaNotFoundError
+from music_assistant.models.errors import AudioError, LoginFailed, MediaNotFoundError
 from music_assistant.models.media_items import (
     Album,
     AlbumType,
@@ -305,9 +305,16 @@ class SpotifyProvider(MusicProvider):
         ]
         if seek_position:
             args += ["--start-position", str(int(seek_position))]
+        bytes_sent = 0
         async with AsyncProcess(args) as librespot_proc:
             async for chunk in librespot_proc.iterate_chunks():
                 yield chunk
+                bytes_sent += len(chunk)
+        # TEMP: diagnose issues with librespot dump details
+        if bytes_sent < 100:
+            async with AsyncProcess(args, use_stderr=True) as librespot_proc:
+                _, stderr = await librespot_proc.communicate()
+            raise AudioError(f"Error getting stream from librespot: {stderr.decode()}")
 
     async def _parse_artist(self, artist_obj):
         """Parse spotify artist object to generic layout."""