From 1e249af41587849e98ec8fd51ad2e477bf9c44e3 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Wed, 3 Apr 2024 20:40:31 -0700 Subject: [PATCH] chore: debug --- src/_data/music.js | 17 +++++++---------- src/_data/test.js | 10 ---------- 2 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 src/_data/test.js diff --git a/src/_data/music.js b/src/_data/music.js index c8c5cd62..7e0430d2 100644 --- a/src/_data/music.js +++ b/src/_data/music.js @@ -1,13 +1,10 @@ -import EleventyFetch from '@11ty/eleventy-fetch'; +import { readFile } from 'fs/promises' import { buildChart } from './helpers/music.js' export default async function () { - const API_KEY_MUSIC = process.env.API_KEY_MUSIC; - const url = `https://coryd.dev/api/music?key=${API_KEY_MUSIC}`; - const res = EleventyFetch(url, { - duration: '1h', - type: 'json', - }).catch(); - const resObj = await res; - return buildChart(resObj['scrobbles'], resObj['artists'], resObj['albums'], resObj['nowPlaying']) -} + const window = JSON.parse(await readFile('./src/_data/json/scrobbles-window.json', 'utf8')); + const artists = JSON.parse(await readFile('./src/_data/json/artists-map.json', 'utf8')); + const albums = JSON.parse(await readFile('./src/_data/json/albums-map.json', 'utf8')); + const nowPlaying = JSON.parse(await readFile('./src/_data/json/now-playing.json', 'utf8')); + return buildChart(window['data'], artists, albums, nowPlaying) +} \ No newline at end of file diff --git a/src/_data/test.js b/src/_data/test.js deleted file mode 100644 index facf7e73..00000000 --- a/src/_data/test.js +++ /dev/null @@ -1,10 +0,0 @@ -import { readFile } from 'fs/promises' -import { buildChart } from './helpers/music.js' - -export default async function () { - const window = JSON.parse(await readFile('./src/_data/json/scrobbles-window.json', 'utf8')); - const artists = JSON.parse(await readFile('./src/_data/json/artists-map.json', 'utf8')); - const albums = JSON.parse(await readFile('./src/_data/json/albums-map.json', 'utf8')); - const nowPlaying = JSON.parse(await readFile('./src/_data/json/now-playing.json', 'utf8')); - return buildChart(window['data'], artists, albums, nowPlaying) -}