Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 44x 5x 3x 2x 2x 2x 2x 2x 2x 2x | import { ArtistScrobbleInfo, fullFilledValue, getArtistScrobbleInfo, getMBID, getMusicFanArt, } from "utils"; export async function getArtistInfo( artistName?: string ): Promise<ArtistScrobbleInfo | null> { if (!artistName) return null; try { const [artistScrobbleInfoSettled, mbidSettled] = await Promise.allSettled([ getArtistScrobbleInfo(artistName), getMBID(artistName), ]); const artistScrobbleInfo = fullFilledValue(artistScrobbleInfoSettled); const mbid = fullFilledValue(mbidSettled) || artistScrobbleInfo?.mbid; const artistInfo = artistScrobbleInfo || ({} as ArtistScrobbleInfo); Iif (mbid) { const musicFanArt = await getMusicFanArt(mbid); Iif (musicFanArt) { const banner = musicFanArt?.artistbackground?.[0]?.url; Iif (banner) { artistInfo.banner = "/_next/image?url=" + banner + "&w=2048&q=100"; } artistInfo.thumb = musicFanArt?.artistthumb?.[0]?.url; } } return artistInfo; } catch (error) { console.error(error); return null; } } |