Nouveau champ autoImport dans Settings — quand désactivé, le worker ne se lance jamais automatiquement. Activé par défaut pour conserver le comportement existant. Le toggle est exposé dans SettingsView avec une description claire. feat(organize): nommage des fichiers selon original_filename ou formatted_name Selon l'option NFO : - nfoSupport activé → original_filename (correspond aux .nfo GitLab) - nfoSupport désactivé → formatted_name de l'API Fankai (format Jellyfin/Plex standardisé, ex: Serie.S01E01.MULTI.1080p.x264-FANKAI.mkv) formatted_name est maintenant injecté dans enrichSeriesDataWithOriginalFilenames en même temps que original_filename. feat(catalogue): tri du catalogue avec 4 options - A→Z (défaut, localeCompare français) - Z→A - Récents (par année décroissante) - Importés (fichiers importés en premier) feat(catalogue): badge IMPORTÉ et refresh automatique post-import - Renommage ORGANISÉ → IMPORTÉ sur les affiches et dans les toasts - Le catalogue se rafraîchit automatiquement quand fetchOrganizeNotifs détecte de nouvelles notifications d'import feat(settings): textes génériques sans mention de logiciels spécifiques - "Dossier Complétion" → "Dossier Téléchargements" - "Dossier Jellyfin" → "Médiathèque Fankai" - "Mode Organisation" → "Mode Import" - "Organisation" → "Import" partout dans l'interface feat(downloads): bouton Organiser tout renommé Importer tout Itère sur tous les torrents seeding non importés et les envoie séquentiellement à /api/organize avec feedback toast de progression.
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import fs from 'fs'
|
|
import path from 'path'
|
|
import { DATA_DIR } from './config.js'
|
|
|
|
const DATA_PATH = path.join(DATA_DIR, 'settings.json')
|
|
|
|
export interface Settings {
|
|
mediaPath : string
|
|
completePath : string
|
|
organizeMode : 'hardlink' | 'move'
|
|
category : string
|
|
nfoSupport : boolean
|
|
autoImport : boolean // import automatique quand un torrent passe en seeding
|
|
}
|
|
|
|
const defaults: Settings = {
|
|
mediaPath : '',
|
|
completePath : '',
|
|
organizeMode : 'hardlink',
|
|
category : 'fankai',
|
|
nfoSupport : false,
|
|
autoImport : true,
|
|
}
|
|
|
|
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
|
|
} |