fix Jellyfin imageId normalization

This commit is contained in:
jeffvli
2025-12-28 02:26:27 -08:00
parent f21ca83179
commit 88711eac2f
+11 -3
View File
@@ -154,7 +154,7 @@ const normalizeSong = (
artists: (item?.ArtistItems?.length ? item.ArtistItems : item.AlbumArtists)?.map( artists: (item?.ArtistItems?.length ? item.ArtistItems : item.AlbumArtists)?.map(
(entry) => ({ (entry) => ({
id: entry.Id, id: entry.Id,
imageId: entry.Id, imageId: null,
imageUrl: null, imageUrl: null,
name: entry.Name, name: entry.Name,
}), }),
@@ -292,7 +292,7 @@ const normalizeAlbumArtist = (
item.similarArtists?.Items?.filter((entry) => entry.Name !== 'Various Artists').map( item.similarArtists?.Items?.filter((entry) => entry.Name !== 'Various Artists').map(
(entry) => ({ (entry) => ({
id: entry.Id, id: entry.Id,
imageId: entry.Id, imageId: getAlbumArtistImageId(entry),
imageUrl: null, imageUrl: null,
name: entry.Name, name: entry.Name,
}), }),
@@ -392,6 +392,14 @@ const normalizeMusicFolder = (item: z.infer<typeof jfType._response.musicFolder>
// }; // };
// }; // };
const getGenreImageId = (item: z.infer<typeof jfType._response.genre>): null | string => {
if (item.ImageTags?.Primary) {
return item.Id;
}
return null;
};
const normalizeGenre = ( const normalizeGenre = (
item: z.infer<typeof jfType._response.genre>, item: z.infer<typeof jfType._response.genre>,
server: null | ServerListItem, server: null | ServerListItem,
@@ -402,7 +410,7 @@ const normalizeGenre = (
_serverType: ServerType.JELLYFIN, _serverType: ServerType.JELLYFIN,
albumCount: null, albumCount: null,
id: item.Id, id: item.Id,
imageId: item.Id, imageId: getGenreImageId(item),
imageUrl: null, imageUrl: null,
name: item.Name, name: item.Name,
songCount: null, songCount: null,