feat: move images to b2 and route through bunny

This commit is contained in:
Cory Dransfeldt 2024-07-10 08:57:00 -07:00
commit 6a338ceb92
No known key found for this signature in database
32 changed files with 322 additions and 375 deletions
src/_data

View file

@ -54,7 +54,7 @@ const fetchGenreMapping = async () => {
export default async function () {
const genreMapping = await fetchGenreMapping()
const artists = await fetchPaginatedData('artists', 'id, mbid, name_string, image, total_plays, country, description, favorite, tattoo, genres')
const artists = await fetchPaginatedData('artists', 'id, mbid, name_string, art(filename_disk), total_plays, country, description, favorite, tattoo, genres')
const albums = await fetchPaginatedData('albums', 'mbid, name, release_year, total_plays, artist')
const albumsByArtist = albums.reduce((acc, album) => {
if (!acc[album.artist]) acc[album.artist] = []
@ -68,9 +68,10 @@ export default async function () {
}, {})
for (const artist of artists) {
artist.albums = albumsByArtist[artist.id]?.sort((a, b) => a['release_year'] - b['release_year']) || []
artist.country = parseCountryField(artist.country)
artist.genres = genreMapping[artist.genres] || ''
artist.albums = albumsByArtist[artist['id']]?.sort((a, b) => a['release_year'] - b['release_year']) || []
artist.image = `/${artist['art']['filename_disk']}`
artist.country = parseCountryField(artist['country'])
artist.genres = genreMapping[artist['genres']] || ''
}
return artists