chore: scrobbling

This commit is contained in:
Cory Dransfeldt 2024-03-29 16:13:09 -07:00
parent e442cf7e1c
commit 2205fa168d
No known key found for this signature in database

View file

@ -114,10 +114,10 @@ export default async (request) => {
await scrobbles.setJSON('now-playing', {...trackScrobbleData, ...{ url: `https://musicbrainz.org/artist/${artistInfo?.['mbid']}`}})
let scrobbleUpdate = scrobbleData
let windowUpdate = windowData;
if (scrobbleUpdate['data']) scrobbleUpdate['data'].push(trackScrobbleData)
if (!scrobbleUpdate['data']) scrobbleUpdate = { data: [trackScrobbleData] }
if (windowData['data']) windowUpdate['data'].push(trackScrobbleData)
if (!windowData['data']) windowUpdate = { data: [trackScrobbleData] }
if (scrobbleUpdate?.['data']) scrobbleUpdate['data'].push(trackScrobbleData)
if (!scrobbleUpdate?.['data']) scrobbleUpdate = { data: [trackScrobbleData] }
if (windowData?.['data']) windowUpdate['data'].push(trackScrobbleData)
if (!windowData?.['data']) windowUpdate = { data: [trackScrobbleData] }
windowUpdate = { data: filterOldScrobbles(windowUpdate.data) }
await scrobbles.setJSON(`${weekStop()}`, scrobbleUpdate)
await scrobbles.setJSON('window', windowUpdate)