feat: dynamic media pages

This commit is contained in:
Cory Dransfeldt 2024-10-17 19:47:44 -07:00
parent ae973948c8
commit 0187aaa766
No known key found for this signature in database
13 changed files with 560 additions and 360 deletions

View file

@ -36,7 +36,11 @@ export default async function () {
try {
const movies = await fetchAllMovies()
const favoriteMovies = movies.filter(movie => movie['favorite'])
const recentlyWatchedMovies = movies.filter(movie => movie['last_watched'] && year - DateTime.fromISO(movie['last_watched']).year <= 3)
const now = DateTime.now();
const recentlyWatchedMovies = movies.filter(movie => {
const lastWatched = movie['last_watched']
return (lastWatched && now.diff(DateTime.fromISO(lastWatched), 'months').months <= 6)
})
return {
movies,

View file

@ -46,7 +46,7 @@ export default async function () {
return {
shows,
recentlyWatched: episodes.slice(0, 225),
recentlyWatched: episodes.slice(0, 125),
favorites: shows.filter(show => show.favorite).sort((a, b) => a.title.localeCompare(b.title)),
}
} catch (error) {