fix linting and make code nicer

This commit is contained in:
mrjvs 2023-03-10 20:54:56 +01:00
parent 84913aa63d
commit ac28f32ef4

View File

@ -54,16 +54,21 @@ export async function getMetaFromId(
throw err;
}
const imdbId = data.external_ids.find(
let imdbId = data.external_ids.find(
(v) => v.provider === "imdb_latest"
)?.external_id ?? data.external_ids.find(
(v) => v.provider === "imdb"
)?.external_id;
const tmdbId = data.external_ids.find(
)?.external_id
if (!imdbId)
imdbId = data.external_ids.find(
(v) => v.provider === "imdb"
)?.external_id;
let tmdbId = data.external_ids.find(
(v) => v.provider === "tmdb_latest"
)?.external_id ?? data.external_ids.find(
(v) => v.provider === "tmdb"
)?.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");