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
/coffee https://www.buymeacoffee.com/cory 301
/tags /search 301
/tags/* /search 301
/music/genre/* /music/genres/:splat 301
/reading /books
/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",
"version": "21.1.3",
"version": "21.1.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
"version": "21.1.3",
"version": "21.1.4",
"license": "MIT",
"dependencies": {
"@cdransf/api-text": "^1.4.0",

View file

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

View file

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

View file

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