diff --git a/lib/dashboard.ts b/lib/dashboard.ts index 951ed51..847bcb0 100644 --- a/lib/dashboard.ts +++ b/lib/dashboard.ts @@ -16,9 +16,15 @@ export async function getDashboardData() { const totalArticleViews = (await getViews()).views const topArtist = await getTopArtist() const {genre} = await getTopGenre() - const {minutesListened} = await getStats() + const {minutesListened, streams} = await getStats() const metrics: Metric[] = [ + { + title: "Streams", + value: +streams, + group: "Spotify", + href: "https://open.spotify.com/?" + }, { title: "Minutes listened", value: +minutesListened, diff --git a/lib/statsfm.ts b/lib/statsfm.ts index 93f038f..7fea878 100644 --- a/lib/statsfm.ts +++ b/lib/statsfm.ts @@ -6,6 +6,7 @@ const STATSFM_LIFETIME_STATS = `https://beta-api.stats.fm/api/v1/users/${STATSFM type StatsFmResponse = { items: { durationMs: number + count: number } } @@ -18,8 +19,10 @@ export const getStats = async () => { }).then(r => r.json()) as StatsFmResponse const minutesListened = ((response.items.durationMs / 1000) / 60).toFixed(0) + const streams = response.items.count return { - minutesListened + minutesListened, + streams } } \ No newline at end of file