Fix: Prevent error when opening a track from a folder that ha snot been synced yet
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 19:05:36 +0000 (20:05 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 17 Feb 2025 19:05:36 +0000 (20:05 +0100)
music_assistant/providers/filesystem_local/__init__.py

index d5eb0325409271ce092407049eef56f50d293b1d..150ecfa08e2600a05885394da563e9e50fd93b69 100644 (file)
@@ -538,9 +538,12 @@ class LocalFileSystemProvider(MusicProvider):
             prov_artist_id, self.instance_id
         )
         if not db_artist:
-            # this should not be possible, but just in case
-            msg = f"Artist not found: {prov_artist_id}"
-            raise MediaNotFoundError(msg)
+            # this may happen if the artist is not in the db yet
+            # e.g. when browsing the filesystem
+            if await self.exists(prov_artist_id):
+                return await self._parse_artist(prov_artist_id, artist_path=prov_artist_id)
+            return await self._parse_artist(prov_artist_id)
+
         # prov_artist_id is either an actual (relative) path or a name (as fallback)
         safe_artist_name = create_safe_string(prov_artist_id, lowercase=False, replace_space=False)
         if await self.exists(prov_artist_id):