chore: revert some normalization

This commit is contained in:
Cory Dransfeldt 2023-10-10 10:31:12 -07:00
parent bb44264198
commit 79e95a6d1d

View file

@ -1,30 +1,3 @@
const artistAliases = {
"aliases": [
{
"artist": "Aesop Rock",
"aliases": ["Aesop Rock & Homeboy Sandman", "Aesop Rock & Blockhead"]
},
{
"artist": "Fen",
"aliases": ["Sleepwalker & Fen"]
},
{
"artist": "Osees",
"aliases": ["OCS", "The Ohsees", "Thee Oh Sees", "Thee Oh See's"]
},
{
"artist": "Tom Waits",
"aliases": ["Tom Waits & Crystal Gayle", "Crystal Gayle"]
}
]
}
const aliasArtist = (artist) => {
const aliased = artistAliases.aliases.find((alias) => alias.aliases.includes(artist))
if (aliased) artist = aliased.artist
return artist
}
export default async () => { export default async () => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const API_APPLE_MUSIC_DEVELOPER_TOKEN = Netlify.env.get('API_APPLE_MUSIC_DEVELOPER_TOKEN') const API_APPLE_MUSIC_DEVELOPER_TOKEN = Netlify.env.get('API_APPLE_MUSIC_DEVELOPER_TOKEN')
@ -75,9 +48,9 @@ export default async () => {
const track = trackRes.data?.[0]['attributes'] const track = trackRes.data?.[0]['attributes']
return Response.json({ return Response.json({
artist: aliasArtist(track['artistName']), artist: track['artistName'],
title: track['name'], title: track['name'],
text: `🎧 ${track['name']} by ${aliasArtist(track['artistName'])}`, text: `🎧 ${track['name']} by ${track['artistName']}`,
}) })
} }