chore: add show years

This commit is contained in:
Cory Dransfeldt 2024-08-01 15:02:25 -07:00
parent 9d5be86198
commit 7e1be46b2e
No known key found for this signature in database
5 changed files with 13 additions and 8 deletions

View file

@ -75,7 +75,7 @@
/mastodon https://social.lol/@cory 301 /mastodon https://social.lol/@cory 301
/coffee https://www.buymeacoffee.com/cory 301 /coffee https://www.buymeacoffee.com/cory 301
/tags /search 301 /tags /search 301
/tags/* /search 301
/music/genre/* /music/genres/:splat 301
/reading /books /reading /books
/stats /search 301 /stats /search 301
/tags/* /search 301
/music/genre/* /music/genres/:splat 301

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "21.1.3", "version": "21.1.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "coryd.dev", "name": "coryd.dev",
"version": "21.1.3", "version": "21.1.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@cdransf/api-text": "^1.4.0", "@cdransf/api-text": "^1.4.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "21.1.3", "version": "21.1.4",
"description": "The source for my personal site. Built using 11ty (and other tools).", "description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module", "type": "module",
"scripts": { "scripts": {

View file

@ -53,6 +53,7 @@ const prepareEpisodeData = (show) => show['episodes'].map(episode => ({
...episode, ...episode,
show_title: show['title'], show_title: show['title'],
show_tmdb_id: show['tmdb_id'], show_tmdb_id: show['tmdb_id'],
show_year: show['year'],
collected: show['collected'], collected: show['collected'],
favorite: show['favorite'], favorite: show['favorite'],
image: show['image'], image: show['image'],
@ -66,12 +67,14 @@ const formatEpisodeData = (episodes) => {
const showEpisodesMap = {} const showEpisodesMap = {}
episodes.forEach(episode => { episodes.forEach(episode => {
const showTmdbId = episode.show_tmdb_id const showTmdbId = episode['show_tmdb_id']
const showYear = episode['show_year']
if (!showEpisodesMap[showTmdbId]) { if (!showEpisodesMap[showTmdbId]) {
showEpisodesMap[showTmdbId] = { showEpisodesMap[showTmdbId] = {
title: episode['show_title'], title: episode['show_title'],
tmdbId: showTmdbId, tmdbId: showTmdbId,
year: showYear,
collected: episode['collected'], collected: episode['collected'],
favorite: episode['favorite'], favorite: episode['favorite'],
dateAdded: episode['last_watched_at'], dateAdded: episode['last_watched_at'],
@ -89,6 +92,7 @@ const formatEpisodeData = (episodes) => {
episode: episode['episode_number'], episode: episode['episode_number'],
season: episode['season_number'], season: episode['season_number'],
tmdbId: showTmdbId, tmdbId: showTmdbId,
year: showYear,
type: 'tv', type: 'tv',
dateAdded: episode['last_watched_at'], dateAdded: episode['last_watched_at'],
lastWatchedAt: episode['last_watched_at'], lastWatchedAt: episode['last_watched_at'],
@ -113,6 +117,7 @@ const formatEpisodeData = (episodes) => {
episode: endingEpisode, episode: endingEpisode,
season: endingSeason, season: endingSeason,
tmdbId: show['tmdbId'], tmdbId: show['tmdbId'],
year: show['year'],
collected: show['collected'], collected: show['collected'],
favorite: show['favorite'], favorite: show['favorite'],
type: 'tv-range', type: 'tv-range',
@ -130,7 +135,6 @@ export default async function () {
const rawShows = await fetchAllShows() const rawShows = await fetchAllShows()
const shows = rawShows.map(prepareShowData) const shows = rawShows.map(prepareShowData)
const episodes = shows.flatMap(prepareEpisodeData).sort((a, b) => new Date(b['last_watched_at']) - new Date(a['last_watched_at'])) const episodes = shows.flatMap(prepareEpisodeData).sort((a, b) => new Date(b['last_watched_at']) - new Date(a['last_watched_at']))
const favoriteShows = shows.filter(show => show.favorite) const favoriteShows = shows.filter(show => show.favorite)
return { return {

View file

@ -16,6 +16,7 @@
</div> </div>
{% else %} {% else %}
<div class="header">{{ item.name }}</div> <div class="header">{{ item.name }}</div>
<div class="subheader flex-centered">{{ item.year }}</div>
{% endif %} {% endif %}
</div> </div>
{%- capture loadingStrategy -%} {%- capture loadingStrategy -%}