From dccab9b0bf084b974db4d2fd5ae64179c7ed2eb9 Mon Sep 17 00:00:00 2001 From: adrifcastr Date: Wed, 21 Jun 2023 13:26:03 +0200 Subject: [PATCH] directly get poster url --- src/backend/metadata/getmeta.ts | 3 ++- src/components/media/MediaCard.tsx | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/backend/metadata/getmeta.ts b/src/backend/metadata/getmeta.ts index b347e720..21b6843a 100644 --- a/src/backend/metadata/getmeta.ts +++ b/src/backend/metadata/getmeta.ts @@ -7,6 +7,7 @@ import { getEpisodes, getExternalIds, getMediaDetails, + getMediaPoster, mediaTypeToTMDB, } from "./tmdb"; import { @@ -56,7 +57,7 @@ export function formatTMDBMetaResult( id: details.id, title: movie.title, object_type: mediaTypeToTMDB(type), - poster: movie.poster_path ?? undefined, + poster: getMediaPoster(movie.poster_path) ?? undefined, original_release_year: new Date(movie.release_date).getFullYear(), }; } diff --git a/src/components/media/MediaCard.tsx b/src/components/media/MediaCard.tsx index fd460bb7..c38b4a2b 100644 --- a/src/components/media/MediaCard.tsx +++ b/src/components/media/MediaCard.tsx @@ -2,8 +2,7 @@ import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { TMDBMediaToId } from "@/backend/metadata/getmeta"; -import { getMediaPoster } from "@/backend/metadata/tmdb"; -import { MWMediaMeta } from "@/backend/metadata/types"; +import { MWMediaMeta } from "@/backend/metadata/types/mw"; import { DotList } from "@/components/text/DotList"; import { IconPatch } from "../buttons/IconPatch"; @@ -56,9 +55,7 @@ function MediaCardContent({ closable ? "" : "group-hover:rounded-lg", ].join(" ")} style={{ - backgroundImage: media.poster - ? `url(${getMediaPoster(media.poster)})` - : undefined, + backgroundImage: media.poster ? `url(${media.poster})` : undefined, }} > {series ? (