feat: recent tracks
This commit is contained in:
parent
9ba4931ca3
commit
ca94df3b61
7 changed files with 92 additions and 10 deletions
|
@ -1,12 +1,14 @@
|
|||
import { readFile } from 'fs/promises'
|
||||
import { buildChart } from './helpers/music.js'
|
||||
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 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, albums),
|
||||
month: buildChart(monthChart['data'], artists, albums),
|
||||
threeMonthChart: buildChart(threeMonthChart['data'], artists, albums),
|
||||
}
|
||||
|
|
Reference in a new issue