chore: scrobbling

This commit is contained in:
Cory Dransfeldt 2024-03-29 15:00:01 -07:00
parent eebda14a41
commit ac6e58bb09
No known key found for this signature in database

View file

@ -116,10 +116,10 @@ export default async (request) => {
await scrobbles.setJSON('now-playing', JSON.stringify(trackScrobbleData))
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] }
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] }
await scrobbles.setJSON(`${weekStop()}`, JSON.stringify(scrobbleUpdate))
await scrobbles.setJSON('window', JSON.stringify(filterOldScrobbles(windowUpdate.data)))
}