- Port par défaut 3001 → 9898 - Volume /app/data → /config (entrypoint, docker-compose, README) - Normalisation titres Kaï/Kai dans index.ts (catalogue + déduplication + serie detail) - Fix pagination GitLab NFO (per_page=100 → loop multi-pages) - Fix _is_bonus_filename avec word boundaries (\b) — évite faux positifs "national"→"ona" - Fix dossier Bonus/Specials exclus : récupère flottants (7,5/19,5) et S00Exx → saison 0 - _EP_FLOAT_PATTERN supporte virgules (7,5) en plus des points (7.5) - Ajout strict_season dans find_episode/resolve_ep — évite collision ep1 S1 vs ep1 S2 (JoJo Parties) - Ajout SEASON_EP_OFFSET pour Hokuto No Ken (saison 02 torrent → +16 offset API) - Fallback non-strict si strict_season échoue (Hokuto ep 5-16 S1) - Fix collect_covered_episodes : fallback torrent.serie_id si absent dans resolved_episodes - Fix s6_verify : get_all_specials + compteur S00 séparé, déduplication Kaï/Kai, format OK/TOTAL - Ajout MANUAL_TORRENTS dans s4 (MHA Film 4 You're Next URL Nyaa) - Injection torrents locaux manquants dans pipeline (Reborn! Kaï via fichier local) - Fix s5 : résolution directe torrents manuels season_number=0 - Fix s2 : pack_saga_slash et pack_partie_slash → pack_integrale, lookahead (?<!/) sur episode_num_tiret_apres - Fix s5 skip condition : re-résoudre si resolved_count < files_count (Fairy Tail) - README : note hardlinks volumes multiples, port, chemins config
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
const _isBunBinary = typeof (globalThis as any).Bun !== 'undefined'
|
|
&& path.dirname((process as any).execPath) !== process.cwd()
|
|
const BASE_DIR = _isBunBinary
|
|
? path.dirname((process as any).execPath)
|
|
: process.cwd()
|
|
const DATA_PATH = path.join(BASE_DIR, 'config', 'settings.json')
|
|
|
|
export interface Settings {
|
|
mediaPath : string
|
|
completePath : string
|
|
organizeMode : 'hardlink' | 'move'
|
|
category : string
|
|
nfoSupport : boolean // téléchargement NFO/images depuis GitLab Fankai Pack
|
|
}
|
|
|
|
const defaults: Settings = {
|
|
mediaPath : '',
|
|
completePath : '',
|
|
organizeMode : 'hardlink',
|
|
category : 'fankai',
|
|
nfoSupport : false,
|
|
}
|
|
|
|
export function readSettings(): Settings {
|
|
try {
|
|
if (!fs.existsSync(DATA_PATH)) return { ...defaults }
|
|
return { ...defaults, ...JSON.parse(fs.readFileSync(DATA_PATH, 'utf-8')) }
|
|
} catch { return { ...defaults } }
|
|
}
|
|
|
|
export function writeSettings(settings: Partial<Settings>): Settings {
|
|
const current = readSettings()
|
|
const updated = { ...current, ...settings }
|
|
fs.mkdirSync(path.dirname(DATA_PATH), { recursive: true })
|
|
fs.writeFileSync(DATA_PATH, JSON.stringify(updated, null, 2))
|
|
return updated
|
|
} |