re-add tmdbId

This commit is contained in:
thehairy 2023-05-21 21:00:35 +02:00
parent bb869fd7e3
commit fa36493c50
3 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import { MWMediaType } from "@/backend/metadata/types";
export const testData: DetailedMeta[] = [
{
imdbId: "tt10954562",
tmdbId: "572716",
meta: {
id: "439596",
title: "Hamilton",
@ -14,6 +15,7 @@ export const testData: DetailedMeta[] = [
},
{
imdbId: "tt11126994",
tmdbId: "94605",
meta: {
id: "222333",
title: "Arcane",

View File

@ -30,6 +30,7 @@ interface JWDetailedMeta extends JWMediaResult {
export interface DetailedMeta {
meta: MWMediaMeta;
imdbId?: string;
tmdbId?: string;
}
export async function getMetaFromId(
@ -60,6 +61,12 @@ export async function getMetaFromId(
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;
if (!tmdbId)
tmdbId = data.external_ids.find((v) => v.provider === "tmdb")?.external_id;
let seasonData: JWSeasonMetaResult | undefined;
if (data.object_type === "show") {
const seasonToScrape = seasonId ?? data.seasons?.[0].id.toString() ?? "";
@ -72,5 +79,6 @@ export async function getMetaFromId(
return {
meta: formatJWMeta(data, seasonData),
imdbId,
tmdbId,
};
}

View File

@ -24,6 +24,7 @@ const testData: VideoData = {
};
const testMeta: DetailedMeta = {
imdbId: "",
tmdbId: "",
meta: {
id: "hello-world",
title: "Big Buck Bunny",