fix: Build-Fehler JSX, xREL TV-Support mit type:tv Parameter

This commit is contained in:
2026-06-18 12:01:25 +02:00
parent 940e1860b7
commit fe6fa0324f
2 changed files with 43 additions and 41 deletions

View File

@@ -159,7 +159,7 @@ async function xrelFetch(path, params = {}) {
// Einzige Funktion für xREL: benutzt immer die ext_info_id und gibt max 5 deutsche ≤1080p Releases
// Cache-Key: tmdb_id (immer eindeutig, konsistent zwischen Badge und Modal)
async function getXrelData(tmdbId, imdbId, title, originalTitle, movieYear) {
async function getXrelData(tmdbId, imdbId, title, originalTitle, movieYear, mediaType='movie') {
const cacheKey = `xrel:tmdb:${tmdbId}`;
const cached = cacheGet(cacheKey);
if (cached !== undefined) return cached;
@@ -180,7 +180,7 @@ async function getXrelData(tmdbId, imdbId, title, originalTitle, movieYear) {
return {
q,
data: await xrelFetch('/search/ext_info.json', {
q: normalizeUmlauts(q).replace(/[*#!?:]/g,''), type:'movie', limit:10
q: normalizeUmlauts(q).replace(/[*#!?:]/g,''), type:mediaType, limit:10
})
};
} catch(_) { return null; }
@@ -221,7 +221,7 @@ async function getXrelData(tmdbId, imdbId, title, originalTitle, movieYear) {
const [sceneData, p2pData, infoData] = await Promise.all([
xrelFetch('/release/ext_info.json', { id: extInfoId, per_page: 50 }).catch(()=>({})),
xrelFetch('/p2p/releases.json', { ext_info_id: extInfoId, per_page: 50 }).catch(()=>({})),
xrelFetch('/ext_info/info.json', { id: extInfoId, type: 'movie' }).catch(()=>({})),
xrelFetch('/ext_info/info.json', { id: extInfoId, type: mediaType }).catch(()=>({})),
]);
// xREL Erscheinungsdaten
@@ -463,7 +463,7 @@ router.get('/movie/:id/xrel', authenticate, async (req, res) => {
// Filmjahr aus Query-Param; year=0 oder fehlt → kein Jahresfilter
let filmYear = null;
if (req.query.year && req.query.year !== '0') filmYear = parseInt(req.query.year);
const data = await getXrelData(req.params.id, imdbId, title, origTitle, filmYear);
const data = await getXrelData(req.params.id, imdbId, title, origTitle, filmYear, media_type);
const releases = Array.isArray(data) ? data : (data.releases || []);
const xrel_dates = Array.isArray(data) ? [] : (data.xrel_dates || []);
res.json({ xrel: releases, xrel_dates, has_xrel: releases.length > 0 });

View File

@@ -837,20 +837,19 @@ function MovieModal({ tmdbId, mediaType='movie', onClose, mobile, onHasXrel, noY
detailRef.current = d;
setLoading(false);
// Gecachte Releases laden (nur für Filme)
if (mediaType !== 'tv') {
const params = new URLSearchParams({
const xrelParams = new URLSearchParams({
title: d.title || '',
orig: d.original_title || '',
imdb_id: d.imdb_id || '',
year: noYearFilter ? '0' : (d.release_date ? d.release_date.slice(0,4) : ''),
media_type: mediaType || 'movie',
});
api(`/tools/media/movie/${tmdbId}/xrel?${params}`)
api(`/tools/media/movie/${tmdbId}/xrel?${xrelParams}`)
.then(r => {
if (r.xrel_dates?.length > 0) setXrelDates(r.xrel_dates);
if (r.xrel?.length > 0) { setXrel(r.xrel); onHasXrel?.(tmdbId); }
})
.catch(() => {});
}
})
.catch(e => { setError(e.message); setLoading(false); });
const prev = document.body.style.overflow;
@@ -868,6 +867,7 @@ function MovieModal({ tmdbId, mediaType='movie', onClose, mobile, onHasXrel, noY
orig: d.original_title || '',
imdb_id: d.imdb_id || '',
year: noYearFilter ? '0' : (d.release_date ? d.release_date.slice(0,4) : ''),
media_type: mediaType || 'movie',
});
if (forceRefresh || noYearFilter) params.set('refresh', '1');
const r = await api(`/tools/media/movie/${tmdbId}/xrel?${params}`);
@@ -1059,7 +1059,8 @@ function MovieModal({ tmdbId, mediaType='movie', onClose, mobile, onHasXrel, noY
</div>
) : null;
})()}
{mediaType !== 'tv' && <div style={{ display:'flex', alignItems:'center', gap:8, marginBottom: xrel?.length ? 8 : 0 }}>
<div>
<div style={{ display:'flex', alignItems:'center', gap:8, marginBottom: xrel?.length ? 8 : 0 }}>
<div style={{ ...S.head, marginBottom:0, flex:1 }}>RELEASES (XREL.TO)</div>
<button
onClick={() => searchXrel(xrel !== null && xrel.length > 0)}
@@ -1074,12 +1075,13 @@ function MovieModal({ tmdbId, mediaType='movie', onClose, mobile, onHasXrel, noY
{xrelLoading ? '⏳ Suche…' : xrel === null ? '🔍 Nach Releases suchen' : '🔄 Erneut suchen'}
</button>
</div>
{mediaType !== 'tv' && xrel !== null && xrel.length === 0 && (
{xrel !== null && xrel.length === 0 && (
<div style={{ fontSize:11, color:'rgba(255,255,255,0.3)', fontFamily:'monospace', fontStyle:'italic' }}>
Keine deutschen Releases gefunden
</div>
)}
</div>
</div>
{xrel !== null && xrel.length > 0 && (
<div style={{ marginTop:4 }}>
<div style={{ display:'flex', flexDirection:'column', gap:4 }}>