fix(organize): migration vers paths { infohash, path } pour le matching fichiers
BREAKING CHANGE: le format paths[] dans series/{id}.json passe de string[]
à { infohash: string, path: string }[] — nécessite une mise à jour du scraper.
fix(organize): buildFileMap matche par infohash au lieu d'index ou titre
L'ancien système utilisait soit un index positionnel fragile, soit le titre
du torrent comme clé de matching — les deux cassaient si l'utilisateur
renommait le torrent dans qBittorrent ou si un pack intégrale ne couvrait
pas tous les épisodes. Désormais chaque path est lié à un infohash précis.
fix(organize): source fichier via save_path qBittorrent + fullPath relatif
path.join(savePath, fullPath) utilise le save_path retourné par qBittorrent
au lieu de deviner le nom du dossier depuis le titre du torrent. Résiste
aux renommages de dossier côté client.
fix(organize): scanMediaPath adapté au nouveau format paths[]
L'index filename → infohash est maintenant construit directement depuis
ep.paths[].infohash sans passer par la hiérarchie torrents série/saison/épisode.
This commit is contained in:
1 parent
a3f3539a27
commit
329150f1c4
2 files changed
+49
-74
No files matched your search
+4
-31
@@ -51,39 +51,12 @@ export async function scanMediaPath(
|
||||
// Construire index filename → infohash depuis les seriesData
|
||||
const filenameIndex = new Map<string, string>() // filename → infohash
|
||||
for (const sd of seriesData) {
|
||||
// Torrents niveau série
|
||||
for (const [i, t] of (sd.torrents ?? []).entries()) {
|
||||
const hash = t.infohash?.toLowerCase()
|
||||
if (!hash) continue
|
||||
for (const season of sd.seasons ?? []) {
|
||||
for (const ep of season.episodes ?? []) {
|
||||
const filePath = (ep.paths ?? [])[i]
|
||||
if (!filePath) continue
|
||||
const filename = filePath.split('/').pop()
|
||||
if (filename) filenameIndex.set(filename, hash)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Torrents niveau saison
|
||||
for (const season of sd.seasons ?? []) {
|
||||
for (const [i, t] of (season.torrents ?? []).entries()) {
|
||||
const hash = t.infohash?.toLowerCase()
|
||||
if (!hash) continue
|
||||
for (const ep of season.episodes ?? []) {
|
||||
const filePath = (ep.paths ?? [])[i]
|
||||
if (!filePath) continue
|
||||
const filename = filePath.split('/').pop()
|
||||
if (filename) filenameIndex.set(filename, hash)
|
||||
}
|
||||
}
|
||||
// Torrents niveau épisode
|
||||
for (const ep of season.episodes ?? []) {
|
||||
for (const [i, t] of (ep.torrents ?? []).entries()) {
|
||||
const hash = t.infohash?.toLowerCase()
|
||||
if (!hash) continue
|
||||
const filePath = (ep.paths ?? [])[i]
|
||||
if (!filePath) continue
|
||||
const filename = filePath.split('/').pop()
|
||||
for (const p of ep.paths ?? []) {
|
||||
const hash = p.infohash?.toLowerCase()
|
||||
if (!hash || !p.path) continue
|
||||
const filename = p.path.split('/').pop()
|
||||
if (filename) filenameIndex.set(filename, hash)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user