Fix bug where sonos app cannot navigate from track to artist when subsonic returns null artistId on song (#79)

This commit is contained in:
Simon J
2021-11-20 18:22:24 +11:00
committed by GitHub
parent 6321cb71a4
commit 89340dd454
6 changed files with 101 additions and 23 deletions

View File

@@ -144,12 +144,14 @@ type GetArtistResponse = SubsonicResponse & {
};
};
type song = {
export type song = {
id: string;
parent: string | undefined;
title: string;
album: string | undefined;
albumId: string | undefined;
artist: string | undefined;
artistId: string | undefined;
track: number | undefined;
year: string | undefined;
genre: string | undefined;
@@ -159,8 +161,6 @@ type song = {
bitRate: number | undefined;
suffix: string | undefined;
contentType: string | undefined;
albumId: string | undefined;
artistId: string | undefined;
type: string | undefined;
userRating: number | undefined;
starred: string | undefined;
@@ -270,9 +270,9 @@ export const asTrack = (album: Album, song: song): Track => ({
coverArt: coverArtURN(song.coverArt),
album,
artist: {
id: `${song.artistId!}`,
name: song.artist!,
image: artistImageURN({ artistId: song.artistId }),
id: song.artistId,
name: song.artist ? song.artist : "?",
image: song.artistId ? artistImageURN({ artistId: song.artistId }) : undefined,
},
rating: {
love: song.starred != undefined,