From cd09c2735c480069aa06c526e5984059b2d49b37 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 23 Jun 2023 12:46:49 -0700 Subject: [PATCH] chore: drop unused data; simplify music name --- src/_data/heavyRotation.js | 20 -------------------- src/_data/{recentTracks.js => music.js} | 0 src/_includes/now.liquid | 8 ++++---- 3 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 src/_data/heavyRotation.js rename src/_data/{recentTracks.js => music.js} (100%) diff --git a/src/_data/heavyRotation.js b/src/_data/heavyRotation.js deleted file mode 100644 index 2bd825b7..00000000 --- a/src/_data/heavyRotation.js +++ /dev/null @@ -1,20 +0,0 @@ -const EleventyFetch = require('@11ty/eleventy-fetch') - -module.exports = async function () { - const APPLE_BEARER = process.env.API_BEARER_APPLE_MUSIC - const APPLE_TOKEN = process.env.API_TOKEN_APPLE_MUSIC - const url = `https://api.music.apple.com/v1/me/history/heavy-rotation` - const res = EleventyFetch(url, { - duration: '1h', - type: 'json', - fetchOptions: { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${APPLE_BEARER}`, - 'music-user-token': `${APPLE_TOKEN}`, - }, - }, - }).catch() - const rotation = await res - return rotation.data -} diff --git a/src/_data/recentTracks.js b/src/_data/music.js similarity index 100% rename from src/_data/recentTracks.js rename to src/_data/music.js diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index 6fe0c10c..361b74a6 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -49,13 +49,13 @@ layout: main Assembling lists of ad and tracker-blocking tools.

-{% if recentTracks.size > 0 %} +{% if music.size > 0 %}

{% heroicon "outline" "microphone" "Artists" "height=28" %}
Artists

- {% for artist in recentTracks.artists %} + {% for artist in music.artists %}
@@ -73,13 +73,13 @@ layout: main {% endfor %}
{% endif %} -{% if recentTracks.size > 0 %} +{% if music.size > 0 %}

{% heroicon "outline" "musical-note" "Albums" "height=28" %}
Albums