diff --git a/config/collections/index.js b/config/collections/index.js index aefe03c8..8445e13c 100644 --- a/config/collections/index.js +++ b/config/collections/index.js @@ -179,7 +179,7 @@ export const albumReleasesCalendar = (collection) => { url: album.url, uid: `${date.toFormat('yyyyMMdd')}-${album.artist}-${album.title}@coryd.dev`, timestamp: DateTime.now().toUTC().toFormat("yyyyMMdd'T'HHmmss'Z'") - }; + } }).filter(event => event !== null) const { error, value } = ics.createEvents(events) diff --git a/package-lock.json b/package-lock.json index 5f003c71..cb0f9d3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "24.0.2", + "version": "24.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "24.0.2", + "version": "24.1.0", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.5.0", diff --git a/package.json b/package.json index 3fa7d05f..8fdf6f7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "24.0.3", + "version": "24.1.0", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "scripts": { diff --git a/src/data/artists.js b/src/data/artists.js index db6bac72..9fea5d1c 100644 --- a/src/data/artists.js +++ b/src/data/artists.js @@ -30,7 +30,9 @@ const fetchAllArtists = async () => { concerts, books, movies, - posts + posts, + related_artists, + shows `) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -83,6 +85,12 @@ const processArtists = (artists) => { tmdb_id: movie['tmdb_id'], url: `/watching/movies/${movie['tmdb_id']}`, })).sort((a, b) => b['year'] - a['year']) : null, + shows: artist['shows']?.[0]?.['id'] ? artist['shows'].map(show => ({ + title: show['title'], + year: show['year'], + tmdb_id: show['tmdb_id'], + url: `/watching/shows/${show['tmdb_id']}`, + })).sort((a, b) => b['year'] - a['year']) : null, posts: artist['posts']?.[0]?.['id'] ? artist['posts'].map(post => ({ id: post['id'], title: post['title'], @@ -90,6 +98,10 @@ const processArtists = (artists) => { slug: post['slug'], url: post['slug'], })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, + relatedArtists: artist['related_artists']?.[0]?.['id'] ? artist['related_artists'].map(relatedArtist => { + relatedArtist['url'] = `/music/artists/${sanitizeMediaString(relatedArtist['name'])}-${sanitizeMediaString(parseCountryField(relatedArtist['country']))}` + return relatedArtist + }).sort((a, b) => a['name'].localeCompare(b['name'])) : null, })) } diff --git a/src/data/books.js b/src/data/books.js index 933b241f..e4109d29 100644 --- a/src/data/books.js +++ b/src/data/books.js @@ -30,10 +30,11 @@ const fetchAllBooks = async () => { tattoo, tags, artists, - movies, genres, + movies, + posts, shows, - posts + related_books `) .order('date_finished', { ascending: false }) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -77,7 +78,7 @@ const processBooks = (books) => { return artist }).sort((a, b) => a['name'].localeCompare(b['name'])) : null, movies: book['movies']?.[0]?.['id'] ? book['movies'].map(movie => { - movie['url'] =`/watching/movies/${movie['tmdb_id']}` + movie['url'] = `/watching/movies/${movie['tmdb_id']}` return movie }).sort((a, b) => b['year'] - a['year']) : null, genres: book['genres']?.[0]?.['id'] ? book['genres'].map(genre => { @@ -95,6 +96,13 @@ const processBooks = (books) => { slug: post['slug'], url: post['slug'], })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, + relatedBooks: book['related_books']?.[0]?.['id'] ? book['related_books'].map(relatedBook => ({ + title: relatedBook['title'], + author: relatedBook['author'], + isbn: relatedBook['isbn'], + description: relatedBook['description'], + url: `/books/${relatedBook['isbn']}`, + })).sort((a, b) => a['title'].localeCompare(b['title'])) : null, // Add related books processing year, } }) diff --git a/src/data/movies.js b/src/data/movies.js index 650f2a4c..dcc4acd5 100644 --- a/src/data/movies.js +++ b/src/data/movies.js @@ -35,7 +35,8 @@ const fetchAllMovies = async () => { books, genres, shows, - posts + posts, + related_movies `) .order('last_watched', { ascending: false }) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -96,6 +97,10 @@ const processMovies = (movies) => { slug: post['slug'], url: post['slug'], })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, + relatedMovies: item['related_movies']?.[0]?.['id'] ? item['related_movies'].map(movie => { + movie['url'] = `/watching/movies/${movie['tmdb_id']}` + return movie + }).sort((a, b) => b['year'] - a['year']) : null, })) } @@ -105,19 +110,15 @@ export default async function () { try { const movies = await fetchAllMovies() const processedMovies = processMovies(movies) - const filterMovies = (condition) => processedMovies.filter(condition) const formatMovieData = (movies) => movies.map(movie => movie) - const favoriteMovies = filterMovies(movie => movie['favorite']) - const collectedMovies = filterMovies(movie => movie['collected']) const recentlyWatchedMovies = filterMovies(movie => movie['lastWatched'] && year - DateTime.fromISO(movie['lastWatched']).year <= 3).sort((a, b) => new Date(b['lastWatched']) - new Date(a['lastWatched'])) return { watchHistory: formatMovieData(filterMovies(movie => movie['lastWatched'])), recentlyWatched: formatMovieData(recentlyWatchedMovies), favorites: formatMovieData(favoriteMovies).sort((a, b) => a['title'].localeCompare(b['title'])), - collection: formatMovieData(collectedMovies), } } catch (error) { console.error('Error fetching and processing movies data:', error) @@ -125,7 +126,6 @@ export default async function () { watchHistory: [], recentlyWatched: [], favorites: [], - collection: [], } } } \ No newline at end of file diff --git a/src/data/tv.js b/src/data/tv.js index 3b95e362..2e8df7f4 100644 --- a/src/data/tv.js +++ b/src/data/tv.js @@ -1,4 +1,5 @@ import { createClient } from '@supabase/supabase-js' +import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js' const SUPABASE_URL = process.env.SUPABASE_URL const SUPABASE_KEY = process.env.SUPABASE_KEY @@ -27,9 +28,11 @@ const fetchAllShows = async () => { backdrop, tags, episodes, - movies, + artists, books, - posts + movies, + posts, + related_shows `) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -72,6 +75,17 @@ const prepareShowData = (show) => ({ slug: post['slug'], url: post['slug'], })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, + relatedShows: show['related_shows']?.[0]?.['id'] ? show['related_shows'].map(relatedShow => ({ + id: relatedShow['id'], + title: relatedShow['title'], + year: relatedShow['year'], + tmdb_id: relatedShow['tmdb_id'], + url: `/watching/shows/${relatedShow['tmdb_id']}`, + })).sort((a, b) => b['year'] - a['year']) : null, + artists: show['artists']?.[0]?.['id'] ? show['artists'].map(artist => { + artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}` + return artist + }).sort((a, b) => a['name'].localeCompare(b['name'])) : null, // Add artists processing }) const prepareEpisodeData = (show) => show['episodes'].map(episode => ({ diff --git a/src/pages/dynamic/books/book.html b/src/pages/dynamic/books/book.html index 54d62074..93dfa13a 100644 --- a/src/pages/dynamic/books/book.html +++ b/src/pages/dynamic/books/book.html @@ -61,6 +61,7 @@ schema: book