diff --git a/config/mediaFilters.js b/config/mediaFilters.js
index 8216bee0..eb054750 100644
--- a/config/mediaFilters.js
+++ b/config/mediaFilters.js
@@ -1,18 +1,25 @@
-const ALBUM_DENYLIST = ['no-love-deep-web', 'unremittance']
-
module.exports = {
- artist: (media) =>
- `https://cdn.coryd.dev/artists/${media.replace(/\s+/g, '-').toLowerCase()}.jpg` ||
- 'https://cdn.coryd.dev/artists/missing-artist.jpg',
- album: (media) => {
- return !ALBUM_DENYLIST.includes(media.name.replace(/\s+/g, '-').toLowerCase())
- ? media.replace('https://lastfm.freetls.fastly.net', 'https://albums.coryd.dev')
- : `https://cdn.coryd.dev/albums/${media.name.replace(/\s+/g, '-').toLowerCase()}.jpg`
- },
- tv: (episode) =>
- `https://cdn.coryd.dev/tv/${episode.replace(':', '').replace(/\s+/g, '-').toLowerCase()}.jpg` ||
- 'https://cdn.coryd.dev/tv/missing-tv.jpg',
- cdn: (url, host, cdn) => {
- return url.replace(host, cdn)
- },
+ normalizeMedia: (media) =>
+ media.map((item) => {
+ let normalized = {
+ image: item['image'],
+ url: item['url'],
+ }
+ if (item.type === 'album') {
+ normalized['title'] = item['title']
+ normalized['alt'] = `${item['title']} by ${item['artist']}`
+ normalized['subtext'] = item['artist']
+ }
+ if (item.type === 'artist') {
+ normalized['title'] = item['title']
+ normalized['subtext'] = `${item['plays']} plays`
+ }
+ if (item.type === 'book') normalized['alt'] = item['title']
+ if (item.type === 'movie') normalized['title'] = item['title']
+ if (item.type === 'tv') {
+ normalized['title'] = item['title']
+ normalized['subtext'] = `${item.name} • ${item.episode}`
+ }
+ return normalized
+ }),
}
diff --git a/src/_data/albums.js b/src/_data/albums.js
index 02194395..b5f239f1 100644
--- a/src/_data/albums.js
+++ b/src/_data/albums.js
@@ -11,7 +11,7 @@ module.exports = async function () {
const data = await res
return data['topalbums'].album.map((album) => {
return {
- name: album['name'],
+ title: album['name'],
artist: album['artist']['name'],
plays: album['playcount'],
rank: album['@attr']['rank'],
@@ -26,6 +26,7 @@ module.exports = async function () {
url: album['mbid']
? `https://musicbrainz.org/album/${album['mbid']}`
: `https://musicbrainz.org/search?query=${encodeURI(album['name'])}&type=release_group`,
+ type: 'album',
}
})
}
diff --git a/src/_data/artists.js b/src/_data/artists.js
index 6158b2a6..0734236e 100644
--- a/src/_data/artists.js
+++ b/src/_data/artists.js
@@ -10,7 +10,7 @@ module.exports = async function () {
const data = await res
return data['topartists'].artist.map((artist) => {
return {
- name: artist['name'],
+ title: artist['name'],
plays: artist['playcount'],
rank: artist['@attr']['rank'],
image:
@@ -19,6 +19,7 @@ module.exports = async function () {
url: artist['mbid']
? `https://musicbrainz.org/artist/${artist['mbid']}`
: `https://musicbrainz.org/search?query=${encodeURI(artist['name'])}&type=artist`,
+ type: 'artist',
}
})
}
diff --git a/src/_data/books.js b/src/_data/books.js
index 236e7f9d..dbde0610 100644
--- a/src/_data/books.js
+++ b/src/_data/books.js
@@ -25,6 +25,7 @@ module.exports = async function () {
isbn: book['isbn'],
description: book['book_description'],
dateAdded: book['user_date_added'],
+ type: 'book',
})
})
const books = data.splice(0, 6)
diff --git a/src/_data/movies.js b/src/_data/movies.js
index 872b4d1e..5a062e8b 100644
--- a/src/_data/movies.js
+++ b/src/_data/movies.js
@@ -13,7 +13,7 @@ module.exports = async function () {
.map((item) => {
const images = item['content']?.match(/]*src="[^"]*"[^>]*>/gm) || []
return {
- name: item['title'],
+ title: item['title'],
date: item['pubDate'],
summary: item['contentSnippet'],
image: images.length
@@ -23,6 +23,7 @@ module.exports = async function () {
: 'https://cdn.coryd.dev/movies/missing-movie.jpg',
url: item['link'],
id: item['guid'],
+ type: 'movie',
}
})
.filter((movie) => !movie.url.includes('/list/'))
diff --git a/src/_data/tv.js b/src/_data/tv.js
index eb16d331..bd6b161f 100644
--- a/src/_data/tv.js
+++ b/src/_data/tv.js
@@ -14,6 +14,19 @@ module.exports = async function () {
},
},
}).catch()
- const shows = await res
- return shows.splice(0, 6)
+ const data = await res
+ return data.map((episode) => {
+ return {
+ name: episode['show']['title'],
+ title: episode['episode']['title'],
+ url: `https://trakt.tv/shows/${episode['show']['ids']['slug']}/seasons/${episode['episode']['season']}/episodes/${episode['episode']['number']}`,
+ episode: `S${episode['episode']['season']}E${episode['episode']['number']}`,
+ image:
+ `https://cdn.coryd.dev/tv/${episode['show']['title']
+ .replace(':', '')
+ .replace(/\s+/g, '-')
+ .toLowerCase()}.jpg` || 'https://cdn.coryd.dev/tv/missing-tv.jpg',
+ type: 'tv',
+ }
+ })
}
diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid
index 581255c5..746ab1fd 100644
--- a/src/_includes/now.liquid
+++ b/src/_includes/now.liquid
@@ -3,13 +3,13 @@ layout: main
---
{% render "partials/header.liquid", site: site, page: page, nav: nav %}
{{ content }}
-{% render "partials/now/artists.liquid", music:artists %}
-{% render "partials/now/albums.liquid", music:albums %}
+{% render "partials/now/media-grid.liquid", data:artists, icon: "microphone-2", title: "Artists", shape: "square", count: 8 %}
+{% render "partials/now/media-grid.liquid", data:albums, icon: "vinyl", title: "Albums", shape: "square", count: 8 %}
{% render "partials/now/albumReleases.liquid", albumReleases:albumReleases %}
-{% render "partials/now/books.liquid", books:books %}
+{% render "partials/now/media-grid.liquid", data:books, icon: "books", title: "Books", shape: "vertical", count: 6 %}
{% render "partials/now/links.liquid", links:links %}
-{% render "partials/now/movies.liquid", movies:movies %}
-{% render "partials/now/tv.liquid", tv:tv %}
+{% render "partials/now/media-grid.liquid", data:movies, icon: "movie", title: "Movies", shape: "vertical", count: 6 %}
+{% render "partials/now/media-grid.liquid", data:tv, icon: "device-tv", title: "TV", shape: "vertical", count: 6 %}
This is a now page, and if you have your own site, you should make one too.
diff --git a/src/_includes/partials/now/albums.liquid b/src/_includes/partials/now/albums.liquid deleted file mode 100644 index ffc73e98..00000000 --- a/src/_includes/partials/now/albums.liquid +++ /dev/null @@ -1,23 +0,0 @@ -{% if music.size > 0 %} -