From f1c40865dac436caccfd6e4b0c3db715e001d17f Mon Sep 17 00:00:00 2001 From: MasutaYunikon Date: Tue, 21 Apr 2026 23:49:38 +0200 Subject: [PATCH] fix: les fichiers non selectionner sur un torrent ne produise plus d'erreurs d'import --- server/organize-worker.ts | 6 ++- server/routes/series.ts | 6 +-- src/components/serie/SerieSeasonCard.vue | 26 ++++++---- src/views/SerieView.vue | 65 +++++++++++++++++++++++- 4 files changed, 86 insertions(+), 17 deletions(-) diff --git a/server/organize-worker.ts b/server/organize-worker.ts index 9f97dc2..8d12f55 100644 --- a/server/organize-worker.ts +++ b/server/organize-worker.ts @@ -380,8 +380,10 @@ async function organizeTorrent(hash: string, name: string, savePath: string, ser for (const c of candidates) { if (fs.existsSync(c)) { src = c; break } } if (!src) { - error(`Fichier source introuvable : ${filename}`) - result.errors.push({ file: filename, error: 'Source introuvable' }) + // Fichier absent du disque : pas encore téléchargé ou hors sélection (priorité 0). + // On skip silencieusement — pas une erreur. + debug(`Fichier non disponible (skip) : ${filename}`) + result.skipped++ continue } diff --git a/server/routes/series.ts b/server/routes/series.ts index b2a750a..20c96af 100644 --- a/server/routes/series.ts +++ b/server/routes/series.ts @@ -86,7 +86,7 @@ router.get('/series/:id', requireAuth, async (req, res) => { for (const season of serieData.seasons ?? []) { for (const t of (season.torrents ?? [])) { if (!seasonTorrentMapBySn[season.season_number]) seasonTorrentMapBySn[season.season_number] = [] - seasonTorrentMapBySn[season.season_number].push({ torrent_url: t.torrent_url, magnet: t.magnet, type: 'pack_saison', raw: t.title, manual: t.manual ?? false }) + seasonTorrentMapBySn[season.season_number].push({ torrent_url: t.torrent_url, magnet: t.magnet, infohash: t.infohash?.toLowerCase() ?? null, type: 'pack_saison', raw: t.title, manual: t.manual ?? false }) const resolved = buildResolvedEpisodes(serieData, t.infohash, season.season_number) for (const ep of resolved) availableEpisodeIds.add(ep.episode_id) const orgFiles = organized[t.infohash?.toLowerCase()] ?? {} @@ -99,7 +99,7 @@ router.get('/series/:id', requireAuth, async (req, res) => { for (const t of (ep.torrents ?? [])) { if (!episodeTorrentMap[ep.id]) episodeTorrentMap[ep.id] = [] const pathEntry = (ep.paths ?? []).find((p: any) => typeof p === 'object' && p.infohash?.toLowerCase() === t.infohash?.toLowerCase()) - episodeTorrentMap[ep.id].push({ torrent_url: t.torrent_url, magnet: t.magnet, type: 'episode', raw: t.title, manual: t.manual ?? false, fankai: t.fankai ?? true, file_index: pathEntry?.file_index ?? null, file_path: pathEntry?.path ?? null }) + episodeTorrentMap[ep.id].push({ torrent_url: t.torrent_url, magnet: t.magnet, infohash: t.infohash?.toLowerCase() ?? null, type: 'episode', raw: t.title, manual: t.manual ?? false, fankai: t.fankai ?? true, file_index: pathEntry?.file_index ?? null, file_path: pathEntry?.path ?? null }) availableEpisodeIds.add(ep.id) const orgFiles = organized[t.infohash?.toLowerCase()] ?? {} const isOrg = orgFiles[String(ep.id)] !== undefined @@ -124,7 +124,7 @@ router.get('/series/:id', requireAuth, async (req, res) => { if (!pack) continue seenPackHashes.add(hashKey) if (!episodeTorrentMap[ep.id]) episodeTorrentMap[ep.id] = [] - episodeTorrentMap[ep.id].push({ torrent_url: pack.torrent_url, magnet: pack.magnet, type: pack.type, raw: pack.raw, manual: false, fankai: pack.fankai, file_index: pathEntry.file_index ?? null, file_path: pathEntry.path ?? null }) + episodeTorrentMap[ep.id].push({ torrent_url: pack.torrent_url, magnet: pack.magnet, infohash: hashKey, type: pack.type, raw: pack.raw, manual: false, fankai: pack.fankai, file_index: pathEntry.file_index ?? null, file_path: pathEntry.path ?? null }) availableEpisodeIds.add(ep.id) } } diff --git a/src/components/serie/SerieSeasonCard.vue b/src/components/serie/SerieSeasonCard.vue index 06d8b10..1e22fe0 100644 --- a/src/components/serie/SerieSeasonCard.vue +++ b/src/components/serie/SerieSeasonCard.vue @@ -129,7 +129,7 @@