diff --git a/package.json b/package.json index 31d098fc..bde871a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "22.6.6", + "version": "22.7.0", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "scripts": { diff --git a/src/assets/styles/pages/music.css b/src/assets/styles/pages/music.css index 75fa3ad2..6f6a24b8 100644 --- a/src/assets/styles/pages/music.css +++ b/src/assets/styles/pages/music.css @@ -32,7 +32,15 @@ stroke: var(--books); } } - + + & p.movies { + color: var(--tv); + + & svg { + stroke: var(--tv); + } + } + & p > svg { margin-bottom: var(--inline-margin-bottom); } diff --git a/src/assets/styles/pages/watching.css b/src/assets/styles/pages/watching.css index 8a24b070..b94fd886 100644 --- a/src/assets/styles/pages/watching.css +++ b/src/assets/styles/pages/watching.css @@ -139,6 +139,15 @@ aspect-ratio: var(--aspect-ratio-banner); } + & p.music { + color: var(--music); + + & svg { + stroke: var(--music); + margin-bottom: var(--inline-margin-bottom); + } + } + & .watching-meta { display: flex; flex-direction: column; diff --git a/src/data/artists.js b/src/data/artists.js index 5edbad11..976d4e80 100644 --- a/src/data/artists.js +++ b/src/data/artists.js @@ -28,7 +28,8 @@ const fetchAllArtists = async () => { art, albums, concerts, - books + books, + movies `) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -67,14 +68,20 @@ const processArtists = (artists) => { totalPlays: album['total_plays'], art: album.art ? `/${album['art']}` : '' })).sort((a, b) => a['release_year'] - b['release_year']), - concerts: artist['concerts']?.[0]?.id ? artist['concerts'].sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, - books: artist['books']?.[0]?.id ? artist['books'].map(book => ({ + concerts: artist['concerts']?.[0]?.['id'] ? artist['concerts'].sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, + books: artist['books']?.[0]?.['id'] ? artist['books'].map(book => ({ title: book['title'], author: book['author'], isbn: book['isbn'], description: book['description'], url: `/books/${book['isbn']}`, - })).sort((a, b) => a['title'].localeCompare(b['title'])) : null + })).sort((a, b) => a['title'].localeCompare(b['title'])) : null, + movies: artist['movies']?.[0]?.['id'] ? artist['movies'].map(movie => ({ + title: movie['title'], + year: movie['year'], + tmdb_id: movie['tmdb_id'], + url: `/watching/movies/${movie['tmdb_id']}`, + })).sort((a, b) => b['year'] - a['year']) : null, })) } diff --git a/src/data/books.js b/src/data/books.js index ad47f616..48d8416e 100644 --- a/src/data/books.js +++ b/src/data/books.js @@ -49,10 +49,6 @@ const processBooks = (books) => { return books.map(book => { const dateFinished = new Date(book['date_finished']) const year = dateFinished.getUTCFullYear() - const artists = book?.['artists']?.map(artist => { - artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}` - return artist - }).sort((a, b) => a['name'].localeCompare(b['name'])) return { title: book['title'], @@ -69,7 +65,10 @@ const processBooks = (books) => { tags: Array.isArray(book['tags']) ? book['tags'] : book['tags']?.split(',') || [], // Ensure tags is an array isbn: book['isbn'], type: 'book', - artists, + artists: book['artists']?.[0]?.['id'] ? book['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, year, } }) diff --git a/src/data/movies.js b/src/data/movies.js index 10888826..6fe75cdd 100644 --- a/src/data/movies.js +++ b/src/data/movies.js @@ -1,5 +1,6 @@ import { createClient } from '@supabase/supabase-js' import { DateTime } from 'luxon' +import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js' const SUPABASE_URL = process.env.SUPABASE_URL const SUPABASE_KEY = process.env.SUPABASE_KEY @@ -27,7 +28,8 @@ const fetchAllMovies = async () => { review, art, backdrop, - tags + tags, + artists `) .order('last_watched', { ascending: false }) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -47,29 +49,28 @@ const fetchAllMovies = async () => { } const processMovies = (movies) => { - return movies.map(item => { - const lastWatched = DateTime.fromISO(item['last_watched'], { zone: 'utc' }) - const year = DateTime.now().year - - return { - title: item['title'], - lastWatched: item['last_watched'], - dateAdded: item['last_watched'], - year: item['year'], - url: `/watching/movies/${item['tmdb_id']}`, - description: item['description'], - image: item['art'] ? `/${item['art']}` : '', - backdrop: item['backdrop'] ? `/${item['backdrop']}` : '', - plays: item['plays'], - collected: item['collected'], - favorite: item['favorite'], - rating: item['star_rating'], - review: item['review'], - id: item['tmdb_id'], - type: 'movie', - tags: item['tags'] ? item['tags'].split(',') : [], - } - }) + return movies.map(item => ({ + title: item['title'], + lastWatched: item['last_watched'], + dateAdded: item['last_watched'], + year: item['year'], + url: `/watching/movies/${item['tmdb_id']}`, + description: item['description'], + image: item['art'] ? `/${item['art']}` : '', + backdrop: item['backdrop'] ? `/${item['backdrop']}` : '', + plays: item['plays'], + collected: item['collected'], + favorite: item['favorite'], + rating: item['star_rating'], + review: item['review'], + id: item['tmdb_id'], + type: 'movie', + tags: item['tags'] ? item['tags'].split(',') : [], + artists: item['artists']?.[0]?.['name'] ? item['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, + })) } export default async function () { diff --git a/src/pages/dynamic/music/artists/artist.html b/src/pages/dynamic/music/artists/artist.html index bfe08291..287aefc7 100644 --- a/src/pages/dynamic/music/artists/artist.html +++ b/src/pages/dynamic/music/artists/artist.html @@ -93,7 +93,7 @@ schema: artist {%- if artist.books -%}
- {% tablericon "books" "books" %} + {% tablericon "books" "Books" %} I've read about this artist!
+ {% tablericon "device-tv-old" "Movies" %} + {{ sectionTitle}} +
+Album | diff --git a/src/pages/dynamic/watching/movie.html b/src/pages/dynamic/watching/movie.html index 12c5b5bd..ba8d110a 100644 --- a/src/pages/dynamic/watching/movie.html +++ b/src/pages/dynamic/watching/movie.html @@ -50,6 +50,25 @@ schema: movie {{ movie.review | markdown }}
---|