From d39da8d13dfe235ad218e5c9d64187e578a08f5d Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 29 Mar 2024 14:15:04 -0700 Subject: [PATCH] chore: scrobbling --- api/scrobble.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/scrobble.js b/api/scrobble.js index 74d5da87..51c32314 100644 --- a/api/scrobble.js +++ b/api/scrobble.js @@ -110,15 +110,16 @@ export default async (request) => { timestamp, artistUrl } - const scrobbleData = await scrobbles.get(weekStop(1), { type: 'json'}) + const scrobbleData = await scrobbles.get(`${weekStop()}`, { type: 'json'}) const windowData = await scrobbles.get('window', { type: 'json'}) + scrobbleData.setJSON('now-playing', JSON.stringify(scrobbleUpdate)) let scrobbleUpdate = scrobbleData let windowUpdate = windowData; if (scrobbleUpdate) scrobbleUpdate['data'].push(trackScrobbleData) if (!scrobbleUpdate) scrobbleUpdate = { data: [trackScrobbleData] } if (windowData) windowUpdate['data'].push(trackScrobbleData) if (!windowData) windowUpdate = { data: [trackScrobbleData] } - scrobbleData.setJSON('now-playing', JSON.stringify(scrobbleUpdate)) + scrobbleData.setJSON(`${weekStop()}`, JSON.stringify(scrobbleUpdate)) windowData.setJSON('window-data', JSON.stringify(filterOldScrobbles(windowUpdate))) }