From a74ed3e4c7fd9e242de3d0358ece0ed179b5cfc0 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sun, 7 Dec 2025 00:42:01 -0800 Subject: [PATCH] add fallback to album artist if no artists in Jellyfin response (#1329) --- src/shared/api/jellyfin/jellyfin-normalize.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/shared/api/jellyfin/jellyfin-normalize.ts b/src/shared/api/jellyfin/jellyfin-normalize.ts index 09aa0b5da..24105b3ac 100644 --- a/src/shared/api/jellyfin/jellyfin-normalize.ts +++ b/src/shared/api/jellyfin/jellyfin-normalize.ts @@ -203,12 +203,14 @@ const normalizeSong = ( name: entry.Name, })), albumId: item.AlbumId || `dummy/${item.Id}`, - artistName: item?.ArtistItems?.[0]?.Name, - artists: item?.ArtistItems?.map((entry) => ({ - id: entry.Id, - imageUrl: null, - name: entry.Name, - })), + artistName: item?.ArtistItems?.[0]?.Name || item?.AlbumArtists?.[0]?.Name, + artists: (item?.ArtistItems?.length ? item.ArtistItems : item.AlbumArtists)?.map( + (entry) => ({ + id: entry.Id, + imageUrl: null, + name: entry.Name, + }), + ), bitDepth: null, bitRate, bpm: null, @@ -286,11 +288,13 @@ const normalizeAlbum = ( imageUrl: null, name: entry.Name, })) || [], - artists: item.ArtistItems?.map((entry) => ({ - id: entry.Id, - imageUrl: null, - name: entry.Name, - })), + artists: (item.ArtistItems?.length ? item.ArtistItems : item.AlbumArtists)?.map( + (entry) => ({ + id: entry.Id, + imageUrl: null, + name: entry.Name, + }), + ), backdropImageUrl: null, comment: null, createdAt: item.DateCreated,