mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Update tmdb.ts
This commit is contained in:
parent
67d973e73e
commit
49b0a9fc00
1 changed files with 15 additions and 1 deletions
|
@ -91,14 +91,28 @@ export function formatTMDBMeta(
|
||||||
export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem {
|
export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem {
|
||||||
const type = TMDBMediaToMediaItemType(media.object_type);
|
const type = TMDBMediaToMediaItemType(media.object_type);
|
||||||
|
|
||||||
return {
|
// Define the basic structure of MediaItem
|
||||||
|
const mediaItem: MediaItem = {
|
||||||
title: media.title,
|
title: media.title,
|
||||||
id: media.id.toString(),
|
id: media.id.toString(),
|
||||||
year: media.original_release_date?.getFullYear() ?? 0,
|
year: media.original_release_date?.getFullYear() ?? 0,
|
||||||
release_date: media.original_release_date,
|
release_date: media.original_release_date,
|
||||||
poster: media.poster,
|
poster: media.poster,
|
||||||
type,
|
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(
|
export function TMDBIdToUrlId(
|
||||||
|
|
Loading…
Reference in a new issue