From 5637327e8af4a825c5f861faed1cd53cbb5ea508 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Wed, 17 May 2023 17:38:49 -0700 Subject: [PATCH] Fix conditionals on jellyfin normalization --- src/renderer/api/jellyfin/jellyfin-normalize.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/renderer/api/jellyfin/jellyfin-normalize.ts b/src/renderer/api/jellyfin/jellyfin-normalize.ts index 4035108f..13e1b0fe 100644 --- a/src/renderer/api/jellyfin/jellyfin-normalize.ts +++ b/src/renderer/api/jellyfin/jellyfin-normalize.ts @@ -134,8 +134,12 @@ const normalizeSong = ( name: entry.Name, })), albumId: item.AlbumId, - artistName: item.ArtistItems[0]?.Name, - artists: item.ArtistItems.map((entry) => ({ id: entry.Id, imageUrl: null, name: entry.Name })), + artistName: item?.ArtistItems?.[0]?.Name, + artists: item?.ArtistItems?.map((entry) => ({ + id: entry.Id, + imageUrl: null, + name: entry.Name, + })), bitRate: item.MediaSources && Number(Math.trunc(item.MediaSources[0]?.Bitrate / 1000)), bpm: null, channels: null, @@ -162,11 +166,11 @@ const normalizeSong = ( serverType: ServerType.JELLYFIN, size: item.MediaSources && item.MediaSources[0]?.Size, streamUrl: getStreamUrl({ - container: item.MediaSources[0]?.Container, + container: item.MediaSources?.[0]?.Container, deviceId, - eTag: item.MediaSources[0]?.ETag, + eTag: item.MediaSources?.[0]?.ETag, id: item.Id, - mediaSourceId: item.MediaSources[0]?.Id, + mediaSourceId: item.MediaSources?.[0]?.Id, server, }), trackNumber: item.IndexNumber,