Compare commits

...
8 Commits
3 changed files with 21 additions and 7 deletions

No files matched your search

+14
View File
@@ -1,5 +1,19 @@
# Changelog
## [1.0.3](https://github.com/Masutayunikon/FanKarr/compare/v1.0.2...v1.0.3) (2026-03-10)
### Bug Fixes
* organize file ([d6550e9](https://github.com/Masutayunikon/FanKarr/commit/d6550e9961789073be1583e03d599afb6d295004))
## [1.0.2](https://github.com/Masutayunikon/FanKarr/compare/v1.0.1...v1.0.2) (2026-03-10)
### Bug Fixes
* organize use torrent hash and not name ([61901f9](https://github.com/Masutayunikon/FanKarr/commit/61901f9014a759e2950311cd96266ea8201fa902))
## [1.0.1](https://github.com/Masutayunikon/FanKarr/compare/v1.0.0...v1.0.1) (2026-03-10)
+1 -1
View File
@@ -19,7 +19,7 @@ const PORT = 3001
const FANKAI_API = 'https://metadata.fankai.fr'
const TORRENTS_PATH = path.join(process.cwd(), 'data', 'torrent_final.json')
const GITHUB_RAW_URL = process.env.GITHUB_RAW_URL
?? 'https://raw.githubusercontent.com/CHANGE_ME/fankarr-scraper/main/data/torrent_final.json'
?? 'https://raw.githubusercontent.com/masutayunikon/fankarr-scraper/main/data/torrent_final.json'
app.use(express.json())
app.use(cookieParser())
+6 -6
View File
@@ -49,9 +49,9 @@ function readTorrents(): any[] {
} catch { return [] }
}
function findTorrentByName(name: string): any | null {
function findTorrentByHash(hash: string): any | null {
const torrents = readTorrents()
return torrents.find(t => t.raw === name) ?? null
return torrents.find(t => t.infohash?.toLowerCase() === hash.toLowerCase()) ?? null
}
// ─── Filesystem ops ───────────────────────────────────────────
@@ -98,10 +98,10 @@ export async function organizeTorrent(
const result: OrganizeResult = { total: 0, skipped: 0, done: 0, errors: [] }
// Trouver le torrent dans torrent_final.json
const torrent = findTorrentByName(name)
// Trouver le torrent dans torrent_final.json via infohash
const torrent = findTorrentByHash(hash)
if (!torrent) {
throw new Error(`Torrent introuvable dans torrent_final.json : "${name}"`)
throw new Error(`Torrent introuvable dans torrent_final.json pour le hash : "${hash}"`)
}
const serieTitle = torrent.serie_title || torrent.show_title || name
@@ -228,7 +228,7 @@ export async function autoOrganizeAll(
if (t.state !== 'seeding') continue
// Vérifier si tous les fichiers sont déjà organisés
const torrent = findTorrentByName(t.name)
const torrent = findTorrentByHash(t.hash)
if (!torrent) continue
const files: any[] = torrent.torrent_files ?? []