1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-30 16:17:41 +01:00

Merge pull request #189 from lem6ns/external_ids

fix(meta): fallback to no "_latest"
This commit is contained in:
mrjvs 2023-03-10 21:04:27 +01:00 committed by GitHub
commit 30d8e11992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,12 +54,17 @@ export async function getMetaFromId(
throw err; throw err;
} }
const imdbId = data.external_ids.find( let imdbId = data.external_ids.find(
(v) => v.provider === "imdb_latest" (v) => v.provider === "imdb_latest"
)?.external_id; )?.external_id;
const tmdbId = data.external_ids.find( if (!imdbId)
imdbId = data.external_ids.find((v) => v.provider === "imdb")?.external_id;
let tmdbId = data.external_ids.find(
(v) => v.provider === "tmdb_latest" (v) => v.provider === "tmdb_latest"
)?.external_id; )?.external_id;
if (!tmdbId)
tmdbId = data.external_ids.find((v) => v.provider === "tmdb")?.external_id;
if (!imdbId || !tmdbId) throw new Error("not enough info"); if (!imdbId || !tmdbId) throw new Error("not enough info");