feat: alle Erscheinungsdaten im Modal (Kinostart DE/US, Web, Retail, Blu-ray)

This commit is contained in:
2026-06-11 10:09:50 +02:00
parent 71c411a350
commit 8d99ceba04
2 changed files with 36 additions and 21 deletions

View File

@@ -66,24 +66,27 @@ function extractFSK(rd) {
return null;
}
const RELEASE_TYPE_LABEL = { 2:'Kino (limited)', 3:'Kinostart', 4:'Web', 5:'Retail', 6:'TV' };
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);
if (!rd?.results) return [];
const PRIORITY = ['DE','US','GB','FR','AT','CH'];
const entries = [];
for (const country of PRIORITY) {
const c = rd.results.find(r => r.iso_3166_1 === country);
if (!c) continue;
for (const r of c.release_dates) {
if (!r.release_date) continue;
if (!RELEASE_TYPE_LABEL[r.type]) continue; // Premiere+TV überspringen
entries.push({
country,
label: `${RELEASE_TYPE_LABEL[r.type]} (${country})`,
date: r.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;
entries.sort((a, b) => a.date.localeCompare(b.date));
return entries;
}
async function fetchAllPages(path, maxPages = 3) {
const first = await tmdb(path, { page: 1 });