mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-30 16:17:41 +01:00
reduce casts
This commit is contained in:
parent
33b67f32b1
commit
9495a3bf41
1 changed files with 8 additions and 10 deletions
|
@ -49,30 +49,28 @@ export function formatTMDBMetaResult(
|
||||||
): TMDBMediaResult {
|
): TMDBMediaResult {
|
||||||
let tmdbmeta;
|
let tmdbmeta;
|
||||||
if (type === MWMediaType.MOVIE) {
|
if (type === MWMediaType.MOVIE) {
|
||||||
|
const movie = details as TMDBMovieData;
|
||||||
tmdbmeta = {
|
tmdbmeta = {
|
||||||
id: details.id,
|
id: details.id,
|
||||||
title: (details as TMDBMovieData).title,
|
title: movie.title,
|
||||||
object_type: mediaTypeToTMDB(type),
|
object_type: mediaTypeToTMDB(type),
|
||||||
poster: (details as TMDBMovieData).poster_path ?? undefined,
|
poster: movie.poster_path ?? undefined,
|
||||||
original_release_year: Number(
|
original_release_year: Number(movie.release_date?.split("-")[0]),
|
||||||
(details as TMDBMovieData).release_date?.split("-")[0]
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (type === MWMediaType.SERIES) {
|
if (type === MWMediaType.SERIES) {
|
||||||
|
const show = details as TMDBShowData;
|
||||||
tmdbmeta = {
|
tmdbmeta = {
|
||||||
id: details.id,
|
id: details.id,
|
||||||
title: (details as TMDBShowData).name,
|
title: show.name,
|
||||||
object_type: mediaTypeToTMDB(type),
|
object_type: mediaTypeToTMDB(type),
|
||||||
seasons: (details as TMDBShowData).seasons.map((v) => ({
|
seasons: show.seasons.map((v) => ({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
season_number: v.season_number,
|
season_number: v.season_number,
|
||||||
title: v.name,
|
title: v.name,
|
||||||
})),
|
})),
|
||||||
poster: (details as TMDBMovieData).poster_path ?? undefined,
|
poster: (details as TMDBMovieData).poster_path ?? undefined,
|
||||||
original_release_year: Number(
|
original_release_year: Number(show.first_air_date?.split("-")[0]),
|
||||||
(details as TMDBShowData).first_air_date?.split("-")[0]
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue