Ensure sort_name makes it to cache (#1538)
authorMelvyn Harbour <melharbour@gmail.com>
Sat, 3 Aug 2024 13:57:23 +0000 (14:57 +0100)
committerGitHub <noreply@github.com>
Sat, 3 Aug 2024 13:57:23 +0000 (15:57 +0200)
* Ensure sort_name makes it to cache

* Lint

* Split line

* Ruff

---------

Co-authored-by: Marvin Schenkel <marvinschenkel@gmail.com>
music_assistant/server/providers/filesystem_local/base.py

index aaa64c5eda93fa2434ac5b2c07895430581bb4e5..d464eb78d2aaec2466b997a1d1d6f5d6c8aa34ac 100644 (file)
@@ -748,13 +748,18 @@ class FileSystemProviderBase(MusicProvider):
             # album artist(s)
             if tags.album_artists:
                 for index, album_artist_str in enumerate(tags.album_artists):
-                    artist = await self._parse_artist(album_artist_str, album_path=album_dir)
+                    artist = await self._parse_artist(
+                        album_artist_str,
+                        album_path=album_dir,
+                        sort_name=(
+                            tags.album_artist_sort_names[index]
+                            if index < len(tags.album_artist_sort_names)
+                            else None
+                        ),
+                    )
                     if not artist.mbid:
                         with contextlib.suppress(IndexError):
                             artist.mbid = tags.musicbrainz_albumartistids[index]
-                    # album artist sort name
-                    with contextlib.suppress(IndexError):
-                        artist.sort_name = tags.album_artist_sort_names[index]
                     album_artists.append(artist)
             else:
                 # album artist tag is missing, determine fallback