fix: use season number from resolved episodes in priority

This commit is contained in:
MasutaYunikon committed 2026-03-21 04:17:59 +01:00
1 parent 77e6a2e38c
commit 3dd517c37f
1 file changed
+10 -10
+10 -10
View File
@@ -278,16 +278,16 @@ async function organizeTorrent(hash: string, name: string, savePath: string) {
} }
for (const tf of torrentFiles) { for (const tf of torrentFiles) {
const sn = tf.season_number != null ? Number(tf.season_number) : null // Priorité 1 : resolved_episodes (saison API Fankai)
if (sn !== null) { const fromResolved = filenameToSeason.get(tf.filename)
filenameSeasonMap.set(tf.filename, sn) if (fromResolved !== undefined) {
} else { filenameSeasonMap.set(tf.filename, fromResolved)
const fromResolved = filenameToSeason.get(tf.filename) // Priorité 2 : season_number dans torrent_files (dossier Saison/Partie)
if (fromResolved !== undefined) { } else if (tf.season_number != null) {
filenameSeasonMap.set(tf.filename, fromResolved) filenameSeasonMap.set(tf.filename, Number(tf.season_number))
} else if (torrent.season_number !== undefined) { // Priorité 3 : season_number du torrent
filenameSeasonMap.set(tf.filename, torrent.season_number) } else if (torrent.season_number !== undefined) {
} filenameSeasonMap.set(tf.filename, torrent.season_number)
} }
} }