fix: log
This commit is contained in:
1 parent
ef23a7119e
commit
08c4122d5e
1 file changed
+2
-2
+2
-2
@@ -128,6 +128,7 @@ export async function scanMediaPath(
|
|||||||
|
|
||||||
// Track les paires hash:episodeId présentes
|
// Track les paires hash:episodeId présentes
|
||||||
const presentFiles = new Set<string>()
|
const presentFiles = new Set<string>()
|
||||||
|
let noMatch = 0
|
||||||
|
|
||||||
function walk(dir: string) {
|
function walk(dir: string) {
|
||||||
let entries: fs.Dirent[]
|
let entries: fs.Dirent[]
|
||||||
@@ -142,7 +143,7 @@ export async function scanMediaPath(
|
|||||||
const nameWithoutExt = entry.name.replace(/\.[^.]+$/, '')
|
const nameWithoutExt = entry.name.replace(/\.[^.]+$/, '')
|
||||||
const match = filenameIndex.get(nameWithoutExt)
|
const match = filenameIndex.get(nameWithoutExt)
|
||||||
if (!match) {
|
if (!match) {
|
||||||
// Trouver des candidats proches dans l'index (même début de nom)
|
noMatch++
|
||||||
const prefix = nameWithoutExt.slice(0, 20).toLowerCase()
|
const prefix = nameWithoutExt.slice(0, 20).toLowerCase()
|
||||||
const close = [...filenameIndex.keys()].filter(k => k.toLowerCase().startsWith(prefix)).slice(0, 3)
|
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'
|
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')
|
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` : ''}`)
|
logger.info('organize', `Scan terminé — ${result.found} fichiers, ${result.added} ajoutés, ${removed} orphelins supprimés${noMatch > 0 ? `, ${noMatch} non matchés` : ''}`)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in new issue
Block a user