diff --git a/merge.js b/merge.js index 0d8ef45..7d5e406 100644 --- a/merge.js +++ b/merge.js @@ -24,6 +24,10 @@ function getMatchScore(film, query) { return 10; } +function stripSeason(title) { + return normalizeTitle(title).replace(/(saison|season)\s*\d+/g, '').trim(); +} + function mergeResults(arrays, query = '', limit = 5) { const merged = []; arrays.flat().forEach(entry => { @@ -31,7 +35,19 @@ function mergeResults(arrays, query = '', limit = 5) { let foundIdx = -1; for (let i = 0; i < merged.length; i++) { const m = merged[i]; - // Match same year AND at least one significant word in common + + // Regroup series/seasons from same source if base title matches (strip "season X"/"saison X") + const isSeason = /saison|season/i.test(entry.title) && /saison|season/i.test(m.title); + if ( + m.results[0] && m.results[0].source === entry.source && + isSeason && + stripSeason(m.title) === stripSeason(entry.title) + ) { + foundIdx = i; + break; + } + + // Default merge: Match same year AND at least one significant word in common if ( (m.year ? m.year.toString() : '') === entryYear && hasSignificantWordOverlap(entry.title, m.title) @@ -41,7 +57,6 @@ function mergeResults(arrays, query = '', limit = 5) { } } if (foundIdx >= 0) { - console.log(`[MERGE] ${entry.title} (${entryYear}) merged with ${merged[foundIdx].title} (${entryYear})`); merged[foundIdx].results.push({ source: entry.source, ...entry }); } else { merged.push({ diff --git a/public/index.html b/public/index.html index 1c606f6..c717b60 100644 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,7 @@ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #1a1a1a; color: #e0e0e0; margin: 0; padding: 20px; font-size: 14px; } .container { max-width: 1200px; margin: auto; } h1 { color: #fff; text-align: center; } - .searchbox { margin: 20px 0 30px; display: flex; justify-content: center; } + .searchbox { margin: 20px 0 30px; display: flex; justify-content: center; align-items:center; } input[type="text"] { font-size: 1.1em; width: clamp(200px, 60%, 500px); background: #2c2c2c; color: #fff; border: 1px solid #444; border-radius: 4px; padding: 10px 12px; } button { font-size: 1.1em; padding: 10px 18px; background: #007aff; color: #fff; border-radius: 4px; border: none; margin-left: 10px; cursor: pointer; transition: background-color 0.2s; } button:hover { background: #005bb5; } @@ -28,6 +28,13 @@ .year { color: #aaa; } .loader { text-align: center; font-size: 1.2em; color: #888; } .no-results { text-align: center; font-size: 1.1em; color: #999; margin-top:30px;} + .maxagebox { display:flex;align-items:center;margin-left:25px;} + .slider-age-badge { + font-size:1.25em;font-weight:bold; + color:#fff;border-radius:0.5em;padding:2px 10px; + min-width:2.5em;display:inline-block;letter-spacing:0.05em; + margin-left:10px;transition:background 0.2s; + } @@ -37,11 +44,15 @@