fix: xREL erster Klick sucht frisch, Umlaut-Normalisierung (ä→ae, ö→oe, ü→ue, ß→ss)
This commit is contained in:
@@ -15,6 +15,14 @@ const BLOCKED_LANGS = new Set(['tr', 'hi', 'te', 'ta', 'ml', 'kn', 'bn', 'mr', '
|
|||||||
// 16=Animation, 99=Documentary – aber nur rausfiltern wenn explizit kein Spielfilm-Genre dabei
|
// 16=Animation, 99=Documentary – aber nur rausfiltern wenn explizit kein Spielfilm-Genre dabei
|
||||||
const DOC_GENRE_ID = 99;
|
const DOC_GENRE_ID = 99;
|
||||||
|
|
||||||
|
// Umlaut-Normalisierung für xREL-Suche (Nürnberg → Nuernberg etc.)
|
||||||
|
function normalizeUmlauts(s) {
|
||||||
|
return (s||'')
|
||||||
|
.replace(/ä/g,'ae').replace(/ö/g,'oe').replace(/ü/g,'ue')
|
||||||
|
.replace(/Ä/g,'Ae').replace(/Ö/g,'Oe').replace(/Ü/g,'Ue')
|
||||||
|
.replace(/ß/g,'ss');
|
||||||
|
}
|
||||||
|
|
||||||
// ── SQLite Cache ──────────────────────────────────────────────────────────────
|
// ── SQLite Cache ──────────────────────────────────────────────────────────────
|
||||||
function cacheGet(key) {
|
function cacheGet(key) {
|
||||||
const row = db.prepare('SELECT value, expires_at FROM xrel_cache WHERE cache_key=?').get(key);
|
const row = db.prepare('SELECT value, expires_at FROM xrel_cache WHERE cache_key=?').get(key);
|
||||||
@@ -125,7 +133,7 @@ async function getXrelData(tmdbId, imdbId, title, originalTitle) {
|
|||||||
const searchResults = await Promise.all(queries.map(async q => {
|
const searchResults = await Promise.all(queries.map(async q => {
|
||||||
try {
|
try {
|
||||||
return await xrelFetch('/search/ext_info.json', {
|
return await xrelFetch('/search/ext_info.json', {
|
||||||
q: q.replace(/[*#!?:]/g,''), type:'movie', limit:10
|
q: normalizeUmlauts(q).replace(/[*#!?:]/g,''), type:'movie', limit:10
|
||||||
});
|
});
|
||||||
} catch(_) { return null; }
|
} catch(_) { return null; }
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user