1
0
Fork 0
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:
Abdullah Khan 2024-06-22 19:42:06 -04:00 committed by GitHub
parent f10594e013
commit 0753b67b2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -91,28 +91,14 @@ export function formatTMDBMeta(
export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem {
const type = TMDBMediaToMediaItemType(media.object_type);
// Define the basic structure of MediaItem
const mediaItem: MediaItem = {
return {
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(