From de5cb2db8b5046b8676b1999254359a725fb3d56 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Fri, 26 May 2023 17:09:02 -0700 Subject: [PATCH] chore: perf improvements --- config/mediaFilters.js | 10 ++++++++-- src/_data/site.json | 4 +++- src/_data/tv.js | 11 +++++++++-- src/_includes/now.liquid | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/config/mediaFilters.js b/config/mediaFilters.js index 58303b0d..2fd7164a 100644 --- a/config/mediaFilters.js +++ b/config/mediaFilters.js @@ -5,7 +5,13 @@ module.exports = { `https://cdn.coryd.dev/artists/${media.replace(/\s+/g, '-').toLowerCase()}.jpg`, album: (media) => { return !ALBUM_DENYLIST.includes(media.name.replace(/\s+/g, '-').toLowerCase()) - ? media.image[media.image.length - 1]['#text'] - : `https://cdn.coryd.dev/artists/${media.name.replace(/\s+/g, '-').toLowerCase()}.jpg` + ? media.image[media.image.length - 1]['#text'].replace( + 'https://lastfm.freetls.fastly.net', + 'https://albums.coryd.dev' + ) + : `https://cdn.coryd.dev/albums/${media.name.replace(/\s+/g, '-').toLowerCase()}.jpg` + }, + proxy: (url, host, cdn) => { + return url.replace(host, cdn) }, } diff --git a/src/_data/site.json b/src/_data/site.json index 49e71daf..48078158 100644 --- a/src/_data/site.json +++ b/src/_data/site.json @@ -12,7 +12,9 @@ "listenbrainz": "https://listenbrainz.org/user/cdransf/", "pinboard": "https://pinboard.in/u:cdme/profile/public/", "letterboxd": "https://letterboxd.com/cdme", + "letterboxd-host": "https://a.ltrbxd.com", "trakt": "https://trakt.tv/users/cdransf", "oku": "https://oku.club/user/cory", - "coffee": "https://www.buymeacoffee.com/cory" + "coffee": "https://www.buymeacoffee.com/cory", + "cdn-movies": "https://movies.coryd.dev" } diff --git a/src/_data/tv.js b/src/_data/tv.js index ad2beb06..951d740a 100644 --- a/src/_data/tv.js +++ b/src/_data/tv.js @@ -7,10 +7,17 @@ module.exports = async function () { // noinspection JSCheckFunctionSignatures const asset = new AssetCache('tv_data') if (asset.isCacheValid('1h')) return await asset.getCachedValue() - const res = await extract(url).catch((error) => { + const res = await extract(url, { + getExtraEntryFields: (feedEntry) => { + const image = feedEntry['media:thumbnail']['@_url'] + return { + image, + } + }, + }).catch((error) => { console.log(error.message) }) - const data = res.entries.splice(0, 5) + const data = res.entries.splice(0, 6) await asset.save(data, 'json') return data } diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index 7e17cd14..4b9f8baa 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -145,7 +145,7 @@ layout: main
{{ movie.title }}