feat: year charts

This commit is contained in:
Cory Dransfeldt 2024-04-15 13:42:39 -07:00
parent 9317a760b0
commit b324dc6b29
No known key found for this signature in database
5 changed files with 28 additions and 5 deletions

View file

@ -4,12 +4,14 @@ import { buildChart, buildTracksWithArt } from './helpers/music.js'
export default async function () {
const monthChart = JSON.parse(await readFile('./src/_data/json/scrobbles-month-chart.json', 'utf8'));
const threeMonthChart = JSON.parse(await readFile('./src/_data/json/scrobbles-three-month-chart.json', 'utf8'));
const yearChart = JSON.parse(await readFile('./src/_data/json/scrobbles-year-chart.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 recent = JSON.parse(await readFile('./src/_data/json/scrobbles-window.json', 'utf8'))['data'].reverse().splice(0,10)
return {
recent: buildTracksWithArt(recent, artists, albums),
month: buildChart(monthChart['data'], artists, albums),
threeMonthChart: buildChart(threeMonthChart['data'], artists, albums),
threeMonth: buildChart(threeMonthChart['data'], artists, albums),
year: buildChart(yearChart['data'], artists, albums),
}
}