From 38d686a31c86d2b8b383bdfcc65db827c59b4895 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 18 Jul 2023 20:10:57 -0700 Subject: [PATCH] fix: search for artists because rym urls are inconsistent --- src/_data/music.js | 6 +++++- src/_includes/partials/now/artists.liquid | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/_data/music.js b/src/_data/music.js index d1844631..37ea086a 100644 --- a/src/_data/music.js +++ b/src/_data/music.js @@ -95,9 +95,11 @@ module.exports = async function () { const formattedArtist = titleCase(aliasArtist(track.attributes['artistName'])) const formattedAlbum = titleCase(sanitizeMedia(track.attributes['albumName'])) const formattedTrack = sanitizeMedia(track.attributes['name']) + if (!charts.artists[formattedArtist]) { charts.artists[formattedArtist] = { artist: formattedArtist, + url: `https://rateyourmusic.com/search?searchterm=${encodeURI(formattedArtist)}`, plays: 1, } } else { @@ -111,7 +113,9 @@ module.exports = async function () { art: track.attributes.artwork.url.replace('{w}', '300').replace('{h}', '300'), url: track['relationships'] ? `https://song.link/${track['relationships'].albums.data.pop().attributes.url}` - : `https://rateyourmusic.com/search?searchtype=l&searchterm=${formattedAlbum}%20${formattedArtist}`, + : `https://rateyourmusic.com/search?searchtype=l&searchterm=${encodeURI( + formattedAlbum + )}%20${encodeURI(formattedArtist)}`, plays: 1, } } else { diff --git a/src/_includes/partials/now/artists.liquid b/src/_includes/partials/now/artists.liquid index c1ae0d20..442f673a 100644 --- a/src/_includes/partials/now/artists.liquid +++ b/src/_includes/partials/now/artists.liquid @@ -5,7 +5,7 @@
{% for artist in music.artists %} - +