From 8eaea4f1158b23d0cd759d7fc8299aa183265fbc Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 17 Feb 2025 20:05:36 +0100 Subject: [PATCH] Fix: Prevent error when opening a track from a folder that ha snot been synced yet --- music_assistant/providers/filesystem_local/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/music_assistant/providers/filesystem_local/__init__.py b/music_assistant/providers/filesystem_local/__init__.py index d5eb0325..150ecfa0 100644 --- a/music_assistant/providers/filesystem_local/__init__.py +++ b/music_assistant/providers/filesystem_local/__init__.py @@ -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): -- 2.34.1