Compare commits

...
12 Commits
4 changed files with 55 additions and 6 deletions

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ jobs:
shell: pwsh
- name: Build worker
run: bun build server/organize-worker.ts --outfile organize-worker.js
run: bun build server/organize-worker.ts --target node --outfile organize-worker.js
- name: Package archive (Windows)
if: matrix.target == 'windows-x64'
+21
View File
@@ -1,5 +1,26 @@
# Changelog
## [1.11.0](https://github.com/Masutayunikon/FanKarr/compare/v1.10.3...v1.11.0) (2026-03-13)
### Features
* fix worker for multiple series in integral (one piece fix ?) ([2c773f8](https://github.com/Masutayunikon/FanKarr/commit/2c773f83ffd76d82c77a50a9c5729f20ea22b450))
## [1.10.3](https://github.com/Masutayunikon/FanKarr/compare/v1.10.2...v1.10.3) (2026-03-13)
### Bug Fixes
* worker path ([360572b](https://github.com/Masutayunikon/FanKarr/commit/360572b8be64dafbb452dfcb849a40305bf1b8cf))
## [1.10.2](https://github.com/Masutayunikon/FanKarr/compare/v1.10.1...v1.10.2) (2026-03-13)
### Bug Fixes
* add target node ([58b09f2](https://github.com/Masutayunikon/FanKarr/commit/58b09f2267345c60ed589c160f7e47698e9be9a4))
## [1.10.1](https://github.com/Masutayunikon/FanKarr/compare/v1.10.0...v1.10.1) (2026-03-13)
+29 -2
View File
@@ -218,8 +218,35 @@ async function organizeTorrent(hash: string, name: string, savePath: string) {
// ── Téléchargement NFO/images depuis GitLab ───────────────
if (nfoSupport) {
const serieDestRoot = path.join(mediaPath, serieTitle)
await downloadGitlabFolder(serieTitle, serieDestRoot)
// Collecter tous les titres de séries distincts depuis resolved_episodes
// (un pack_integrale peut mélanger plusieurs séries, ex: One Piece Yabai + Kaï)
const serieTitlesMap = new Map<number, string>()
// Titre principal du torrent
serieTitlesMap.set(torrent.serie_id ?? 0, serieTitle)
// Titres alternatifs depuis resolved_episodes
// resolved_episodes n'a pas toujours serie_title → on cherche dans torrent_final.json
const allTorrents: any[] = (() => {
try { return JSON.parse(fs.readFileSync(TORRENTS_PATH, 'utf-8')) } catch { return [] }
})()
const serieIdToTitle = new Map<number, string>()
for (const t of allTorrents) {
if (t.serie_id && t.serie_title) serieIdToTitle.set(t.serie_id, t.serie_title)
}
for (const ep of torrent.resolved_episodes ?? []) {
if (ep.serie_id && !serieTitlesMap.has(ep.serie_id)) {
const title = ep.serie_title ?? serieIdToTitle.get(ep.serie_id)
if (title) serieTitlesMap.set(ep.serie_id, title)
}
}
// Télécharger NFO pour chaque série distincte
for (const title of serieTitlesMap.values()) {
const serieDestRoot = path.join(mediaPath, title)
await downloadGitlabFolder(title, serieDestRoot)
}
}
// ── Cas fichier unique ────────────────────────────────────
+4 -3
View File
@@ -17,9 +17,10 @@ let workerRunning = false
// En binaire Bun compilé : le worker est à côté de l'exécutable
// En Docker/dev : à côté du fichier courant
function resolveWorkerPath(): string {
const _isBunBinary = typeof (globalThis as any).Bun !== 'undefined'
&& path.dirname((process as any).execPath) !== process.cwd()
if (_isBunBinary) {
// Si Bun est présent → le worker est toujours à côté de l'exécutable
// (que ce soit un binaire compilé ou `bun run` en dev)
// En Node/tsx → on utilise import.meta.url
if (typeof (globalThis as any).Bun !== 'undefined') {
return path.join(path.dirname((process as any).execPath), 'organize-worker.js')
}
return path.join(path.dirname(new URL(import.meta.url).pathname), 'organize-worker.js')