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 40 41 42 43 44 | 45x 45x 4x | import { ApiError } from "next/dist/server/api-utils"; import { fanArtTvApiKey } from "./environment"; interface FanArtData { name: string; mbid_id: string; artistbackground: { id: string; url: string; likes: string; }[]; artistthumb: { id: string; url: string; likes: string; }[]; albums: Record<string, unknown>[]; musiclogo: { id: string; url: string; likes: string; }[]; musicbanner: { id: string; url: string; likes: string; }[]; } export async function getMusicFanArt(mbid: string): Promise<FanArtData | null> { Iif (!fanArtTvApiKey) { throw new ApiError(400, "env variable FANART_TV_API_KEY is not set"); } const fanArtRes = await fetch( `http://webservice.fanart.tv/v3/music/${mbid}?api_key=${fanArtTvApiKey}` ); Iif (!fanArtRes.ok) return null; const fanArtData = (await fanArtRes.json()) as FanArtData; return fanArtData; } |