feat: DE/US Kinostart + US Digital Release-Datum im Modal

This commit is contained in:
2026-06-11 09:46:55 +02:00
parent 5941cc26d8
commit 71c411a350
2 changed files with 39 additions and 2 deletions

View File

@@ -65,6 +65,26 @@ function extractFSK(rd) {
for (const r of sorted) { const c = (r.certification||'').trim(); if (c) return c; }
return null;
}
function extractReleaseDates(rd) {
const out = {};
// DE Kinostart (type 3)
const de = rd?.results?.find(r => r.iso_3166_1 === 'DE');
if (de) {
const theatrical = de.release_dates.find(r => r.type === 3);
if (theatrical?.release_date) out.de_cinema = theatrical.release_date.slice(0,10);
}
// US Kinostart (type 3)
const us = rd?.results?.find(r => r.iso_3166_1 === 'US');
if (us) {
const theatrical = us.release_dates.find(r => r.type === 3);
if (theatrical?.release_date) out.us_cinema = theatrical.release_date.slice(0,10);
// US Digital (type 4)
const digital = us.release_dates.find(r => r.type === 4);
if (digital?.release_date) out.us_digital = digital.release_date.slice(0,10);
}
return out;
}
async function fetchAllPages(path, maxPages = 3) {
const first = await tmdb(path, { page: 1 });
const total = Math.min(first.total_pages || 1, maxPages);
@@ -262,6 +282,7 @@ router.get('/movie/:id', authenticate, async (req, res) => {
backdrop_path: detail.backdrop_path, release_date: detail.release_date,
runtime: detail.runtime, vote_average: detail.vote_average,
genres: (detail.genres||[]).map(g => g.name), fsk,
release_dates: extractReleaseDates(detail.release_dates),
cast: (detail.credits?.cast||[]).slice(0,8).map(a => a.name),
director: detail.credits?.crew?.find(c => c.job==='Director')?.name||null,
tmdb_url: `https://www.themoviedb.org/movie/${detail.id}`,