feat: lightweight media pages
This commit is contained in:
parent
cd268580fc
commit
1fb5acd132
11 changed files with 223 additions and 129 deletions
|
@ -22,7 +22,8 @@ const fetchAllMovies = async () => {
|
|||
collected,
|
||||
plays,
|
||||
favorite,
|
||||
rating
|
||||
rating,
|
||||
description
|
||||
`)
|
||||
.order('last_watched', { ascending: false })
|
||||
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
|
||||
|
@ -49,7 +50,7 @@ export default async function () {
|
|||
lastWatched: item['last_watched'],
|
||||
dateAdded: item['last_watched'],
|
||||
year: item['year'],
|
||||
url: `https://www.themoviedb.org/movie/${item['tmdb_id']}`,
|
||||
url: `https://coryd.dev/movies/${item['tmdb_id']}`,
|
||||
description: `${item['title']} (${item['year']})<br/>Watched at: ${DateTime.fromISO(item['last_watched'], { zone: 'utc' }).setZone('America/Los_Angeles').toFormat('MMMM d, yyyy, h:mma')}`,
|
||||
image: `https://coryd.dev/media/movies/poster-${item['tmdb_id']}.jpg`,
|
||||
backdrop: `https://coryd.dev/media/movies/backdrops/backdrop-${item['tmdb_id']}.jpg`,
|
||||
|
@ -57,6 +58,8 @@ export default async function () {
|
|||
collected: item['collected'],
|
||||
favorite: item['favorite'],
|
||||
rating: item['rating'],
|
||||
description: item['description'],
|
||||
id: item['tmdb_id'],
|
||||
type: 'movie'
|
||||
}
|
||||
return movie
|
||||
|
|
|
@ -18,6 +18,7 @@ const fetchAllShows = async () => {
|
|||
collected,
|
||||
favorite,
|
||||
year,
|
||||
description,
|
||||
episodes (
|
||||
episode_number,
|
||||
season_number,
|
||||
|
@ -88,7 +89,7 @@ export default async function () {
|
|||
|
||||
showEpisodesMap[showTmdbId].episodes.push({
|
||||
name: showTitle,
|
||||
url: `https://www.themoviedb.org/tv/${showTmdbId}/season/${seasonNumber}/episode/${episodeNumber}`,
|
||||
url: `https://coryd.dev/shows/${showTmdbId}`,
|
||||
subtext: `${showTitle} • S${seasonNumber}E${episodeNumber}`,
|
||||
episode: episodeNumber,
|
||||
season: seasonNumber,
|
||||
|
@ -112,7 +113,7 @@ export default async function () {
|
|||
if (show.episodes.length > 1) {
|
||||
episodeData.push({
|
||||
name: show.title,
|
||||
url: `https://www.themoviedb.org/tv/${show['tmdbId']}`,
|
||||
url: `https://coryd.dev/shows/${show['tmdbId']}`,
|
||||
subtext: `S${startingSeason}E${startingEpisode} - S${endingSeason}E${endingEpisode}`,
|
||||
startingEpisode,
|
||||
startingSeason,
|
||||
|
@ -138,7 +139,7 @@ export default async function () {
|
|||
|
||||
const favoriteShows = shows.filter(show => show['favorite'])
|
||||
const collectedShows = shows.filter(show => show['collected'])
|
||||
const toWatch = shows.map(show => ({...show, url: `https://www.themoviedb.org/tv/${show['tmdb_id']}`})).filter(show => !show.episodes.some(episode => episode.last_watched_at)).sort((a, b) => a['title'].localeCompare(b['title']))
|
||||
const toWatch = shows.map(show => ({...show, url: `https://coryd.dev/shows/${show['tmdb_id']}`})).filter(show => !show.episodes.some(episode => episode.last_watched_at)).sort((a, b) => a['title'].localeCompare(b['title']))
|
||||
|
||||
return {
|
||||
shows,
|
||||
|
|
Reference in a new issue