diff --git a/src/backend/metadata/tmdb.ts b/src/backend/metadata/tmdb.ts index 28c716d9..a265b051 100644 --- a/src/backend/metadata/tmdb.ts +++ b/src/backend/metadata/tmdb.ts @@ -91,14 +91,28 @@ export function formatTMDBMeta( export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem { const type = TMDBMediaToMediaItemType(media.object_type); - return { + // Define the basic structure of MediaItem + const mediaItem: MediaItem = { title: media.title, id: media.id.toString(), year: media.original_release_date?.getFullYear() ?? 0, release_date: media.original_release_date, poster: media.poster, type, + seasons: undefined, }; + + // If it's a TV show, include the seasons information + if (type === "show") { + const seasons = media.seasons?.map((season) => ({ + title: season.title, + id: season.id.toString(), + number: season.season_number, + })); + mediaItem.seasons = seasons as MWSeasonMeta[]; + } + + return mediaItem; } export function TMDBIdToUrlId( diff --git a/src/components/media/ModalEpisodeSelector.tsx b/src/components/media/ModalEpisodeSelector.tsx index e19b6556..a5e5c727 100644 --- a/src/components/media/ModalEpisodeSelector.tsx +++ b/src/components/media/ModalEpisodeSelector.tsx @@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import { get } from "@/backend/metadata/tmdb"; +import { Flare } from "@/components/utils/Flare"; import { conf } from "@/setup/config"; interface ModalEpisodeSelectorProps { @@ -57,8 +58,8 @@ export function EpisodeSelector({ }, [handleSeasonSelect, tmdbId]); return ( -
- {episode.name} -
-+ {episode.name} +
+