Skip to content

Commit

Permalink
Ensure sort_name makes it to cache (music-assistant#1538)
Browse files Browse the repository at this point in the history
* Ensure sort_name makes it to cache

* Lint

* Split line

* Ruff

---------

Co-authored-by: Marvin Schenkel <[email protected]>
  • Loading branch information
MelHarbour and MarvinSchenkel authored Aug 3, 2024
1 parent ae7ee0f commit 0cb1355
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions music_assistant/server/providers/filesystem_local/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,18 @@ async def _parse_track(self, file_item: FileSystemItem) -> Track:
# 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
Expand Down

0 comments on commit 0cb1355

Please sign in to comment.