|
|
|
@@ -17,8 +17,8 @@ import path from 'path'
|
|
|
|
|
import { parentPort } from 'worker_threads'
|
|
|
|
|
import { DATA_DIR } from './config.js'
|
|
|
|
|
|
|
|
|
|
const TORRENTS_PATH = path.join(DATA_DIR, 'config', 'torrent_final.json')
|
|
|
|
|
const ORGANIZED_PATH = path.join(DATA_DIR, 'config', 'organized.json')
|
|
|
|
|
const TORRENTS_PATH = path.join(DATA_DIR, 'torrent_final.json')
|
|
|
|
|
const ORGANIZED_PATH = path.join(DATA_DIR, 'organized.json')
|
|
|
|
|
|
|
|
|
|
// ─── Utils log ────────────────────────────────────────────────
|
|
|
|
|
// Le worker tourne dans un thread séparé — il passe les logs au thread principal
|
|
|
|
@@ -33,7 +33,7 @@ function debug(msg: string) { parentPort?.postMessage({ type: 'log', level: 'deb
|
|
|
|
|
|
|
|
|
|
function readSettings(): { mediaPath: string; completePath: string; organizeMode: string; nfoSupport: boolean } {
|
|
|
|
|
try {
|
|
|
|
|
const p = path.join(DATA_DIR, 'config', 'settings.json')
|
|
|
|
|
const p = path.join(DATA_DIR, 'settings.json')
|
|
|
|
|
if (!fs.existsSync(p)) return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false }
|
|
|
|
|
return JSON.parse(fs.readFileSync(p, 'utf-8'))
|
|
|
|
|
} catch { return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false } }
|
|
|
|
|