fix: Build-Fehler JSX, xREL TV-Support mit type:tv Parameter
This commit is contained in:
@@ -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 });
|
||||
|
||||
@@ -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({
|
||||
title: d.title || '',
|
||||
orig: d.original_title || '',
|
||||
imdb_id: d.imdb_id || '',
|
||||
year: noYearFilter ? '0' : (d.release_date ? d.release_date.slice(0,4) : ''),
|
||||
});
|
||||
api(`/tools/media/movie/${tmdbId}/xrel?${params}`)
|
||||
.then(r => {
|
||||
if (r.xrel_dates?.length > 0) setXrelDates(r.xrel_dates);
|
||||
if (r.xrel?.length > 0) { setXrel(r.xrel); onHasXrel?.(tmdbId); }
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
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?${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;
|
||||
@@ -864,10 +863,11 @@ function MovieModal({ tmdbId, mediaType='movie', onClose, mobile, onHasXrel, noY
|
||||
setXrelLoading(true);
|
||||
try {
|
||||
const params = 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) : ''),
|
||||
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',
|
||||
});
|
||||
if (forceRefresh || noYearFilter) params.set('refresh', '1');
|
||||
const r = await api(`/tools/media/movie/${tmdbId}/xrel?${params}`);
|
||||
@@ -1059,26 +1059,28 @@ 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 style={{ ...S.head, marginBottom:0, flex:1 }}>RELEASES (XREL.TO)</div>
|
||||
<button
|
||||
onClick={() => searchXrel(xrel !== null && xrel.length > 0)}
|
||||
disabled={xrelLoading}
|
||||
style={{
|
||||
fontSize:10, fontFamily:'monospace', cursor: xrelLoading ? 'default' : 'pointer',
|
||||
background:'rgba(78,205,196,0.1)', border:'1px solid rgba(78,205,196,0.25)',
|
||||
color: xrelLoading ? 'rgba(255,255,255,0.3)' : '#4ecdc4',
|
||||
borderRadius:6, padding:'3px 10px', flexShrink:0,
|
||||
}}
|
||||
>
|
||||
{xrelLoading ? '⏳ Suche…' : xrel === null ? '🔍 Nach Releases suchen' : '🔄 Erneut suchen'}
|
||||
</button>
|
||||
</div>
|
||||
{mediaType !== 'tv' && 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 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)}
|
||||
disabled={xrelLoading}
|
||||
style={{
|
||||
fontSize:10, fontFamily:'monospace', cursor: xrelLoading ? 'default' : 'pointer',
|
||||
background:'rgba(78,205,196,0.1)', border:'1px solid rgba(78,205,196,0.25)',
|
||||
color: xrelLoading ? 'rgba(255,255,255,0.3)' : '#4ecdc4',
|
||||
borderRadius:6, padding:'3px 10px', flexShrink:0,
|
||||
}}
|
||||
>
|
||||
{xrelLoading ? '⏳ Suche…' : xrel === null ? '🔍 Nach Releases suchen' : '🔄 Erneut suchen'}
|
||||
</button>
|
||||
</div>
|
||||
{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 }}>
|
||||
|
||||
Reference in New Issue
Block a user