diff --git a/server/organize.ts b/server/organize.ts index 6248333..2a7ca49 100644 --- a/server/organize.ts +++ b/server/organize.ts @@ -128,6 +128,7 @@ export async function scanMediaPath( // Track les paires hash:episodeId présentes const presentFiles = new Set() + let noMatch = 0 function walk(dir: string) { let entries: fs.Dirent[] @@ -142,7 +143,7 @@ export async function scanMediaPath( const nameWithoutExt = entry.name.replace(/\.[^.]+$/, '') const match = filenameIndex.get(nameWithoutExt) if (!match) { - // Trouver des candidats proches dans l'index (même début de nom) + noMatch++ const prefix = nameWithoutExt.slice(0, 20).toLowerCase() const close = [...filenameIndex.keys()].filter(k => k.toLowerCase().startsWith(prefix)).slice(0, 3) const closeStr = close.length > 0 ? ` | candidats : ${close.map(c => `"${c}"`).join(', ')}` : ' | aucun candidat proche' @@ -195,7 +196,6 @@ export async function scanMediaPath( fs.writeFileSync(organizedPath, JSON.stringify(organized, null, 2), 'utf-8') } - const noMatch = result.found - result.added logger.info('organize', `Scan terminé — ${result.found} fichiers, ${result.added} ajoutés, ${removed} orphelins supprimés${noMatch > 0 ? `, ${noMatch} non matchés` : ''}`) return result