mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
Fix artist image placeholders for Navidrome
This commit is contained in:
@@ -5,6 +5,19 @@ import z from 'zod';
|
|||||||
import { ndType } from './navidrome-types';
|
import { ndType } from './navidrome-types';
|
||||||
import { ssType } from '/@/renderer/api/subsonic/subsonic-types';
|
import { ssType } from '/@/renderer/api/subsonic/subsonic-types';
|
||||||
|
|
||||||
|
const getImageUrl = (args: { url: string | null }) => {
|
||||||
|
const { url } = args;
|
||||||
|
if (url === '/app/artist-placeholder.webp') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url?.match('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
|
||||||
const getCoverArtUrl = (args: {
|
const getCoverArtUrl = (args: {
|
||||||
baseUrl: string | undefined;
|
baseUrl: string | undefined;
|
||||||
coverArtId: string;
|
coverArtId: string;
|
||||||
@@ -146,8 +159,7 @@ const normalizeAlbumArtist = (
|
|||||||
},
|
},
|
||||||
server: ServerListItem | null,
|
server: ServerListItem | null,
|
||||||
): AlbumArtist => {
|
): AlbumArtist => {
|
||||||
const imageUrl =
|
const imageUrl = getImageUrl({ url: item?.largeImageUrl || null });
|
||||||
item.largeImageUrl === '/app/artist-placeholder.webp' ? null : item.largeImageUrl;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
albumCount: item.albumCount,
|
albumCount: item.albumCount,
|
||||||
@@ -166,7 +178,7 @@ const normalizeAlbumArtist = (
|
|||||||
similarArtists:
|
similarArtists:
|
||||||
item.similarArtists?.map((artist) => ({
|
item.similarArtists?.map((artist) => ({
|
||||||
id: artist.id,
|
id: artist.id,
|
||||||
imageUrl: artist?.artistImageUrl || null,
|
imageUrl: getImageUrl({ url: artist?.artistImageUrl || null }),
|
||||||
name: artist.name,
|
name: artist.name,
|
||||||
})) || null,
|
})) || null,
|
||||||
songCount: item.songCount,
|
songCount: item.songCount,
|
||||||
|
|||||||
Reference in New Issue
Block a user