diff --git a/src/components/Music.astro b/src/components/Music.astro index a559fa1..b68e918 100644 --- a/src/components/Music.astro +++ b/src/components/Music.astro @@ -84,11 +84,6 @@ import { Icon } from "astro-icon/components"; - -

scrobbling { nowPlaying: null as unknown, top: [] as unknown[], topArtists: [] as unknown[], - history: [] as unknown[], weekPlays: 0, allTimePlays: 0, estMinutes: 0, @@ -70,16 +69,15 @@ export const GET: APIRoute = async () => { try { const [recent, top, artists, week, info] = await Promise.all([ - call("method=user.getrecenttracks&limit=8&extended=1"), - call("method=user.gettoptracks&period=7day&limit=8"), - call("method=user.gettopartists&period=7day&limit=6"), + call("method=user.getrecenttracks&limit=1&extended=1"), + call("method=user.gettoptracks&period=7day&limit=5"), + call("method=user.gettopartists&period=7day&limit=5"), call(`method=user.getrecenttracks&limit=1&from=${from}`), call("method=user.getinfo"), ]); const rtRaw = (recent as any)?.recenttracks?.track; - const rtArr: any[] = Array.isArray(rtRaw) ? rtRaw : rtRaw ? [rtRaw] : []; - const rt = rtArr[0]; + const rt = Array.isArray(rtRaw) ? rtRaw[0] : rtRaw; const nowPlaying = rt ? { title: rt.name ?? "", @@ -92,16 +90,6 @@ export const GET: APIRoute = async () => { } : null; - const history = rtArr - .filter((t: any) => t["@attr"]?.nowplaying !== "true" && t.date?.uts) - .slice(0, 6) - .map((t: any) => ({ - title: t.name ?? "", - artist: t.artist?.name ?? t.artist?.["#text"] ?? "", - playedAt: n(t.date.uts) * 1000, - })) - .filter((t: any) => t.title); - const topTracks = ((top as any)?.toptracks?.track ?? []) .map((t: any) => ({ title: t.name ?? "", @@ -137,7 +125,6 @@ export const GET: APIRoute = async () => { nowPlaying, top: topTracks, topArtists, - history, weekPlays, allTimePlays, estMinutes, diff --git a/src/pages/index.astro b/src/pages/index.astro index 94e32ea..92473e0 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -11,7 +11,7 @@ import { site, elsewhere } from "../data/site";