chore: scrobbling

This commit is contained in:
Cory Dransfeldt 2024-03-30 17:15:22 -07:00
parent 607d8bdedc
commit 57bfd37920
No known key found for this signature in database

View file

@ -54,15 +54,12 @@ export default async (request) => {
const track = payload['Metadata']['title'] const track = payload['Metadata']['title']
const trackNumber = payload['Metadata']['index'] const trackNumber = payload['Metadata']['index']
const timestamp = DateTime.now() const timestamp = DateTime.now()
const artistKey = sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()
const albumKey = `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}-${sanitizeMediaString(album).replace(/\s+/g, '-').toLowerCase()}`
const artistsMap = await artists.get('artists-map', { type: 'json' }) const artistsMap = await artists.get('artists-map', { type: 'json' })
const albumsMap = await albums.get('albums-map', { type: 'json' }) const albumsMap = await albums.get('albums-map', { type: 'json' })
let artistInfo = {}
let albumInfo = {}
const artistSanitizedKey = `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}` const artistSanitizedKey = `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}`
const albumSanitizedKey = `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}-${sanitizeMediaString(album.replace(/[:\/\\,'']+/g const albumSanitizedKey = `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}-${sanitizeMediaString(album.replace(/[:\/\\,'']+/g
, '').replace(/\s+/g, '-').toLowerCase())}` , '').replace(/\s+/g, '-').toLowerCase())}`
let artistInfo = {}
// if there is no artist blob, populate one // if there is no artist blob, populate one
if (!artistsMap[artistSanitizedKey]) { if (!artistsMap[artistSanitizedKey]) {