From 1806afc9aaca7591ff16f1ab9a47367b1cbdc2aa Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sun, 5 May 2024 16:28:41 -0700 Subject: [PATCH] chore: misc cleanup --- src/_data/books.js | 1 + src/_data/follow.js | 3 +++ src/_data/helpers/music.js | 2 -- src/_data/music.js | 1 + src/_data/musicCharts.js | 1 + src/_data/status.js | 1 + 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/_data/books.js b/src/_data/books.js index 8b88d43c..4e8800e6 100644 --- a/src/_data/books.js +++ b/src/_data/books.js @@ -1,4 +1,5 @@ import { createRequire } from 'module' + const require = createRequire(import.meta.url) const books = require('./json/read.json') diff --git a/src/_data/follow.js b/src/_data/follow.js index e3be7cdf..c69d3751 100644 --- a/src/_data/follow.js +++ b/src/_data/follow.js @@ -1,11 +1,13 @@ export default async function () { const { ActivityFeed } = await import('@11ty/eleventy-activity-feed') const feed = new ActivityFeed() + feed.addSource('rss', '📝', 'https://coryd.dev/feeds/posts') feed.addSource('rss', '🎥', 'https://coryd.dev/feeds/movies') feed.addSource('rss', '📖', 'https://coryd.dev/feeds/books') feed.addSource('rss', '🔗', 'https://coryd.dev/feeds/links') feed.addSource('rss', '🎧', 'https://coryd.dev/feeds/weekly-artist-chart') + const entries = feed.getEntries().catch() const res = await entries const activity = { posts: [] } @@ -19,5 +21,6 @@ export default async function () { date_published: entry.published, }) }) + return activity } \ No newline at end of file diff --git a/src/_data/helpers/music.js b/src/_data/helpers/music.js index 18992a98..51dc660e 100644 --- a/src/_data/helpers/music.js +++ b/src/_data/helpers/music.js @@ -1,5 +1,3 @@ -export const artistCapitalization = (artist) => artistCapitalizationPatches[artist?.toLowerCase()] || artist - const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '') const artistSanitizedKey = (artist) => `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}` const albumSanitizedKey = (artist, album) => `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}-${sanitizeMediaString(album.replace(/[:\/\\,'']+/g diff --git a/src/_data/music.js b/src/_data/music.js index 7e0430d2..94e91a99 100644 --- a/src/_data/music.js +++ b/src/_data/music.js @@ -6,5 +6,6 @@ export default async function () { const artists = JSON.parse(await readFile('./src/_data/json/artists-map.json', 'utf8')); const albums = JSON.parse(await readFile('./src/_data/json/albums-map.json', 'utf8')); const nowPlaying = JSON.parse(await readFile('./src/_data/json/now-playing.json', 'utf8')); + return buildChart(window['data'], artists, albums, nowPlaying) } \ No newline at end of file diff --git a/src/_data/musicCharts.js b/src/_data/musicCharts.js index 3e8cd284..80e17c9e 100644 --- a/src/_data/musicCharts.js +++ b/src/_data/musicCharts.js @@ -8,6 +8,7 @@ export default async function () { const artists = JSON.parse(await readFile('./src/_data/json/artists-map.json', 'utf8')); const albums = JSON.parse(await readFile('./src/_data/json/albums-map.json', 'utf8')); const recent = JSON.parse(await readFile('./src/_data/json/scrobbles-window.json', 'utf8'))['data'].reverse().splice(0,10) + return { recent: buildTracksWithArt(recent, artists, albums), month: buildChart(monthChart['data'], artists, albums), diff --git a/src/_data/status.js b/src/_data/status.js index 33522141..c7b62795 100644 --- a/src/_data/status.js +++ b/src/_data/status.js @@ -7,5 +7,6 @@ export default async function () { type: 'json', }).catch() const status = await res + return status.response['statuses'][0] }