From 86df3054dd1944eabb0a4246d9b5557a4459f85b Mon Sep 17 00:00:00 2001 From: MasutaYunikon Date: Wed, 22 Apr 2026 15:33:11 +0200 Subject: [PATCH] fix: fallback de noms si les noms de torrents se ressemble il fallback sur les noms dans nyaa --- src/views/SerieView.vue | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/views/SerieView.vue b/src/views/SerieView.vue index 3f192c8..ffd0586 100644 --- a/src/views/SerieView.vue +++ b/src/views/SerieView.vue @@ -87,7 +87,7 @@ @click="downloadAll(i); downloadMenuOpen = false" > - {{ integraleLabel(t, i) }} + {{ integraleGroupLabels()[i] }} @@ -171,15 +171,18 @@ const _recentlyOrganized = new Set() // hash:fileIndex ou has const data = computed(() => store.currentSerie) // ── Helpers intégrale ───────────────────────────────────────── -function integraleLabel(t: any, i: number): string { - if (t.torrent_name) return t.torrent_name - const raw = t.raw ?? '' - const quality = raw.match(/\b(2160p|4K|1080p|720p|480p)\b/i)?.[1]?.toUpperCase() - const lang = raw.match(/\b(VOSTFR|MULTI|VF|VO|FR|EN)\b/i)?.[1]?.toUpperCase() - if (quality && lang) return `Intégrale · ${quality} · ${lang}` - if (quality) return `Intégrale · ${quality}` - if (lang) return `Intégrale · ${lang}` - return `Intégrale ${i + 1}` +function integraleGroupLabels(): string[] { + const torrents = data.value?.torrents_integrale ?? [] + const names = torrents.map((t: any) => t.torrent_name ?? null) + const allPresent = names.every((n: any) => n !== null && String(n).trim() !== '') + const allUnique = allPresent && new Set(names).size === names.length + if (allUnique) return names as string[] + // Fallback : titre Nyaa brut + return torrents.map((t: any, i: number) => { + const raw = t.raw ?? '' + if (raw) return raw.length > 65 ? raw.slice(0, 65) + '…' : raw + return `Intégrale ${i + 1}` + }) } // Épisodes couverts par une intégrale donnée (hash commun)