chore: update some more artist data
This commit is contained in:
parent
970c5318b7
commit
95e95861bf
4 changed files with 26 additions and 5 deletions
|
@ -123,11 +123,21 @@ export default async () => {
|
|||
console.log(err);
|
||||
return {}
|
||||
});
|
||||
const artistCapitalzationRes = await fetch("https://coryd.dev/api/artist-capitalization", {
|
||||
type: "json",
|
||||
}).then((data) => {
|
||||
if (data.ok) return data.json()
|
||||
throw new Error('Something went wrong with the artist capitalization endpoint.');
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
return {}
|
||||
});
|
||||
const track = trackRes["recenttracks"]["track"][0];
|
||||
const artist = track["artist"]["#text"];
|
||||
const artist = artistCapitalization(track["artist"]["#text"]);
|
||||
let mbid = track["artist"]["mbid"];
|
||||
let genre = "";
|
||||
let genre = '';
|
||||
const mbidMap = (artist) => mbidRes[artist.toLowerCase()] || "";
|
||||
const artistCapitalization = (artist) => artistCapitalzationRes[artist?.toLowerCase()] || artist
|
||||
|
||||
// mbid mismatches
|
||||
if (mbidMap(artist) !== "") mbid = mbidMap(artist);
|
||||
|
@ -162,9 +172,9 @@ export default async () => {
|
|||
return new Response(JSON.stringify({
|
||||
content: `${emojiMap(
|
||||
genre,
|
||||
track["artist"]["#text"]
|
||||
artist
|
||||
)} <a href="${trackUrl}">${track["name"]}</a> by <a href="${artistUrl}">${
|
||||
track["artist"]["#text"]
|
||||
artist
|
||||
}</a>`,
|
||||
}),
|
||||
{ headers }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "8.3.6",
|
||||
"version": "8.3.7",
|
||||
"description": "The source for my personal site. Built using 11ty.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
5
src/_data/artistCapitalization.js
Normal file
5
src/_data/artistCapitalization.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import artistCapitalizationPatches from './json/artist-capitalization-patches.js';
|
||||
|
||||
export default async function () {
|
||||
return artistCapitalizationPatches
|
||||
}
|
6
src/api/artist-capitalization.liquid
Normal file
6
src/api/artist-capitalization.liquid
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
layout: null
|
||||
eleventyExcludeFromCollections: true
|
||||
permalink: /api/artist-capitalization
|
||||
---
|
||||
{{ artistCapitalization | json }}
|
Reference in a new issue