From d9c148d08cecaec9e9586a9d26d08531338c5625 Mon Sep 17 00:00:00 2001
From: Cory Dransfeldt
Date: Wed, 3 Apr 2024 14:13:49 -0700
Subject: [PATCH] chore: last played track to now page
---
src/_data/helpers/music.js | 3 ++-
src/_data/music.js | 2 +-
src/pages/music.liquid | 9 ---------
src/pages/now.html | 4 ++++
4 files changed, 7 insertions(+), 11 deletions(-)
delete mode 100644 src/pages/music.liquid
diff --git a/src/_data/helpers/music.js b/src/_data/helpers/music.js
index eb2a54b7..58417d7c 100644
--- a/src/_data/helpers/music.js
+++ b/src/_data/helpers/music.js
@@ -7,7 +7,7 @@ const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300
export const mbidMap = (artist) => mbidPatches[artist.toLowerCase()] || ''
-export const buildChart = (tracks, artists, albums) => {
+export const buildChart = (tracks, artists, albums, nowPlaying) => {
const artistsData = {}
const albumsData = {}
const tracksData = {}
@@ -63,5 +63,6 @@ export const buildChart = (tracks, artists, albums) => {
artists: objectToArraySorted(artistsData),
albums: objectToArraySorted(albumsData),
tracks: objectToArraySorted(tracksData),
+ nowPlaying
}
}
\ No newline at end of file
diff --git a/src/_data/music.js b/src/_data/music.js
index 085d0aff..c8c5cd62 100644
--- a/src/_data/music.js
+++ b/src/_data/music.js
@@ -9,5 +9,5 @@ export default async function () {
type: 'json',
}).catch();
const resObj = await res;
- return buildChart(resObj['scrobbles'], resObj['artists'], resObj['albums'])
+ return buildChart(resObj['scrobbles'], resObj['artists'], resObj['albums'], resObj['nowPlaying'])
}
diff --git a/src/pages/music.liquid b/src/pages/music.liquid
deleted file mode 100644
index 9975962f..00000000
--- a/src/pages/music.liquid
+++ /dev/null
@@ -1,9 +0,0 @@
----
-title: Music
-layout: default
-permalink: /music.html
-description: "See what I'm listening to."
----
-{%- assign artist = music.artists | first -%}
-{%- assign album = music.albums | first -%}
-Lately I've been listening to a lot of {{ artist.title }}, and the album {{ album.title }}. The last track I listened to was {{ music.nowPlaying.track }} by {{ music.nowPlaying.artist }}.
\ No newline at end of file
diff --git a/src/pages/now.html b/src/pages/now.html
index a98c02e1..e806d56c 100644
--- a/src/pages/now.html
+++ b/src/pages/now.html
@@ -18,6 +18,10 @@ description: "See what I'm doing now."
{% tablericon "play-basketball" "NBA - Lakers" %}
Rooting for the Lakers. 💜💛
+
+ {% tablericon "headphones" "Listening to" %}
+ The last track I listened to was {{ music.nowPlaying.track }} by {{ music.nowPlaying.artist }}.
+