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

@@ -25,7 +25,7 @@ export type AuthFailure = {
};
export type ArtistSummary = {
id: string;
id: string | undefined;
name: string;
image: BUrn | undefined;
};

View File

@@ -312,10 +312,10 @@ export const track = (bonobUrl: URLBuilder, track: Track) => ({
album: track.album.name,
albumId: `album:${track.album.id}`,
albumArtist: track.artist.name,
albumArtistId: `artist:${track.artist.id}`,
albumArtistId: track.artist.id? `artist:${track.artist.id}` : undefined,
albumArtURI: defaultAlbumArtURI(bonobUrl, track).href(),
artist: track.artist.name,
artistId: `artist:${track.artist.id}`,
artistId: track.artist.id ? `artist:${track.artist.id}` : undefined,
duration: track.duration,
genre: track.album.genre?.name,
genreId: track.album.genre?.id,

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,