fix: check runtime on episode_run_time array first

This commit is contained in:
Bimal Timilsina
2025-03-03 23:38:47 +05:45
parent b93caf65f2
commit e7fc4291bb
+7 -1
View File
@@ -72,7 +72,13 @@ async function getMeta(type, language, tmdbId, rpdbkey) {
.tvInfo({id: tmdbId, language, append_to_response: "videos,credits,external_ids",})
.then(async (res) => {
const imdbRating = res.external_ids.imdb_id ? await getImdbRating(res.external_ids.imdb_id, type) : res.vote_average.toFixed(1);
const runtime = res.last_episode_to_air ? res.last_episode_to_air.runtime : res.next_episode_to_air ? res.next_episode_to_air.runtime : null;
const runtime = Array.isArray(res.episode_run_time) && res.episode_run_time.length > 0
? res.episode_run_time[0]
: res.last_episode_to_air
? res.last_episode_to_air.runtime
: res.next_episode_to_air
? res.next_episode_to_air.runtime
: null;
const resp = {
cast: Utils.parseCast(res.credits),
country: Utils.parseCoutry(res.production_countries),