chore: cache files overwritten during build

This commit is contained in:
Cory Dransfeldt 2024-04-03 21:30:45 -07:00
parent 8deff32772
commit 2d4efa2e74
No known key found for this signature in database
8 changed files with 9 additions and 14 deletions

View file

@ -70,7 +70,6 @@ const emojiMap = (genre, artist) => {
export default async () => {
const TV_KEY = Netlify.env.get("API_KEY_TRAKT");
const MUSIC_KEY = Netlify.env.get("API_KEY_LASTFM");
const scrobbles = getStore('scrobbles')
const headers = {
"Content-Type": "application/json",
@ -85,7 +84,7 @@ export default async () => {
},
})
.then((data) => {
if (data.ok) return data.json();
if (data.ok) return data?.json();
throw new Error('Something went wrong with the Trakt endpoint.');
})
.catch(err => {

View file

@ -1,7 +1,7 @@
import { getStore } from '@netlify/blobs'
import { DateTime } from 'luxon'
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '');
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '').replace(/A©|é/g, 'e');
const weekKey = () => {
const currentDate = DateTime.now();
@ -77,12 +77,7 @@ export default async (request) => {
return {}
});
const artistData = artistRes['artist'];
let mbid = artistData['mbid']
const mbidMap = () => mbidRes[artistData['name'].toLowerCase()] || '';
// mbid mismatches
if (mbidMap() !== "") mbid = mbidMap();
const mbid = artistData['mbid']
const genreUrl = `https://musicbrainz.org/ws/2/artist/${mbid}?inc=aliases+genres&fmt=json`;
const genreRes = await fetch(genreUrl, {
type: "json",