Fix missing file breaks queue (#2341)
authorOzGav <gavnosp@hotmail.com>
Tue, 26 Aug 2025 10:40:04 +0000 (20:40 +1000)
committerGitHub <noreply@github.com>
Tue, 26 Aug 2025 10:40:04 +0000 (12:40 +0200)
music_assistant/providers/filesystem_local/__init__.py

index 222b3f7397c458b4a054f26bac98fa5a918c30e2..5ca6d910bd90f223b70275c488062eee641cb697 100644 (file)
@@ -841,11 +841,19 @@ class LocalFileSystemProvider(MusicProvider):
 
     async def get_stream_details(self, item_id: str, media_type: MediaType) -> StreamDetails:
         """Return the content details for the given track when it will be streamed."""
-        if media_type == MediaType.AUDIOBOOK:
-            return await self._get_stream_details_for_audiobook(item_id)
-        if media_type == MediaType.PODCAST_EPISODE:
-            return await self._get_stream_details_for_podcast_episode(item_id)
-        return await self._get_stream_details_for_track(item_id)
+        try:
+            if media_type == MediaType.AUDIOBOOK:
+                return await self._get_stream_details_for_audiobook(item_id)
+            if media_type == MediaType.PODCAST_EPISODE:
+                return await self._get_stream_details_for_podcast_episode(item_id)
+            return await self._get_stream_details_for_track(item_id)
+        except FileNotFoundError:
+            self.logger.warning(
+                "File not found for media item %s",
+                item_id,
+            )
+            msg = f"Media file not found: {item_id}"
+            raise MediaNotFoundError(msg)
 
     async def resolve_image(self, path: str) -> str | bytes:
         """