feat(settings): ajout de englishDirectory qui permet d'avoir Season XX au lieu de Saison X
This commit is contained in:
1 parent
f23e3c04ec
commit
6f1e0dc844
4 files changed
+15
-5
No files matched your search
@@ -35,12 +35,12 @@ export interface OrgEntry {
|
|||||||
type Organized = Record<string, Record<string, OrgEntry>>
|
type Organized = Record<string, Record<string, OrgEntry>>
|
||||||
|
|
||||||
// ─── Settings ─────────────────────────────────────────────────
|
// ─── Settings ─────────────────────────────────────────────────
|
||||||
function readSettings(): { mediaPath: string; completePath: string; organizeMode: string; nfoSupport: boolean } {
|
function readSettings(): { mediaPath: string; completePath: string; organizeMode: string; nfoSupport: boolean, englishDirectory: boolean } {
|
||||||
try {
|
try {
|
||||||
const p = path.join(DATA_DIR, 'settings.json')
|
const p = path.join(DATA_DIR, 'settings.json')
|
||||||
if (!fs.existsSync(p)) return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false }
|
if (!fs.existsSync(p)) return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false, englishDirectory: false }
|
||||||
return JSON.parse(fs.readFileSync(p, 'utf-8'))
|
return JSON.parse(fs.readFileSync(p, 'utf-8'))
|
||||||
} catch { return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false } }
|
} catch { return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false , englishDirectory: false } }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Organized log ────────────────────────────────────────────
|
// ─── Organized log ────────────────────────────────────────────
|
||||||
@@ -302,7 +302,8 @@ function swapExtension(filename: string, ext: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function seasonFolder(n: number): string {
|
function seasonFolder(n: number): string {
|
||||||
return n === 0 ? 'Specials' : `Saison ${n}`
|
const { englishDirectory } = readSettings()
|
||||||
|
return n === 0 ? 'Specials' : (englishDirectory ? `Season ${String(n).padStart(2, '0')}` : `Saison ${n}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ router.get('/settings', requireAuth, (_req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
router.post('/settings', requireAuth, (req, res) => {
|
router.post('/settings', requireAuth, (req, res) => {
|
||||||
const { mediaPath, completePath, organizeMode, category, nfoSupport, autoImport, devMode, deleteTorrentOnMove, autoUnimportMissing, requestAutoDownloadUsers } = req.body
|
const { mediaPath, completePath, organizeMode, category, nfoSupport, autoImport, devMode, deleteTorrentOnMove, autoUnimportMissing, requestAutoDownloadUsers, englishDirectory } = req.body
|
||||||
const patch: Record<string, any> = {}
|
const patch: Record<string, any> = {}
|
||||||
if (mediaPath !== undefined) patch.mediaPath = mediaPath
|
if (mediaPath !== undefined) patch.mediaPath = mediaPath
|
||||||
if (completePath !== undefined) patch.completePath = completePath
|
if (completePath !== undefined) patch.completePath = completePath
|
||||||
@@ -22,6 +22,7 @@ router.post('/settings', requireAuth, (req, res) => {
|
|||||||
if (deleteTorrentOnMove !== undefined) patch.deleteTorrentOnMove = deleteTorrentOnMove
|
if (deleteTorrentOnMove !== undefined) patch.deleteTorrentOnMove = deleteTorrentOnMove
|
||||||
if (autoUnimportMissing !== undefined) patch.autoUnimportMissing = autoUnimportMissing
|
if (autoUnimportMissing !== undefined) patch.autoUnimportMissing = autoUnimportMissing
|
||||||
if (requestAutoDownloadUsers !== undefined) patch.requestAutoDownloadUsers = requestAutoDownloadUsers
|
if (requestAutoDownloadUsers !== undefined) patch.requestAutoDownloadUsers = requestAutoDownloadUsers
|
||||||
|
if (englishDirectory !== undefined) patch.englishDirectory = englishDirectory
|
||||||
const updated = writeSettings(patch)
|
const updated = writeSettings(patch)
|
||||||
logger.info('api', 'Paramètres mis à jour')
|
logger.info('api', 'Paramètres mis à jour')
|
||||||
res.json(updated)
|
res.json(updated)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export interface Settings {
|
|||||||
requestAutoDownloadUsers: 'all' | string[] // IDs users autorisés au dl auto sur approbation ; [] = désactivé
|
requestAutoDownloadUsers: 'all' | string[] // IDs users autorisés au dl auto sur approbation ; [] = désactivé
|
||||||
jellyfinUrl : string // URL du serveur Jellyfin (ex: http://jellyfin:8096)
|
jellyfinUrl : string // URL du serveur Jellyfin (ex: http://jellyfin:8096)
|
||||||
jellyfinAdminToken : string // Token admin Jellyfin pour la sync
|
jellyfinAdminToken : string // Token admin Jellyfin pour la sync
|
||||||
|
englishDirectory : boolean // Si true, les dossiers de séries sont en anglais (ex: "Season 1" au lieu de "Saison 1")
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaults: Settings = {
|
const defaults: Settings = {
|
||||||
@@ -30,6 +31,7 @@ const defaults: Settings = {
|
|||||||
requestAutoDownloadUsers: [],
|
requestAutoDownloadUsers: [],
|
||||||
jellyfinUrl : '',
|
jellyfinUrl : '',
|
||||||
jellyfinAdminToken : '',
|
jellyfinAdminToken : '',
|
||||||
|
englishDirectory : false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function readSettings(): Settings {
|
export function readSettings(): Settings {
|
||||||
|
|||||||
@@ -103,6 +103,11 @@
|
|||||||
label="Désimporter si fichier manquant"
|
label="Désimporter si fichier manquant"
|
||||||
description="Si un fichier importé n'est plus trouvé sur le disque lors du scan, il est automatiquement retiré de la bibliothèque."
|
description="Si un fichier importé n'est plus trouvé sur le disque lors du scan, il est automatiquement retiré de la bibliothèque."
|
||||||
/>
|
/>
|
||||||
|
<SettingsToggle
|
||||||
|
v-model="form.englishDirectory"
|
||||||
|
label="Utilise 'Season' au lieu de 'Saison' dans les dossiers"
|
||||||
|
description="Si activé, les dossiers de saisons seront nommés 'Season 01' au lieu de 'Saison 01'."
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Plex -->
|
<!-- Plex -->
|
||||||
@@ -215,6 +220,7 @@ const form = ref({
|
|||||||
autoImport : true,
|
autoImport : true,
|
||||||
deleteTorrentOnMove : false,
|
deleteTorrentOnMove : false,
|
||||||
autoUnimportMissing : false,
|
autoUnimportMissing : false,
|
||||||
|
englishDirectory : false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const picker = ref<{ open: boolean; field: 'completePath' | 'mediaPath'; currentPath: string }>({
|
const picker = ref<{ open: boolean; field: 'completePath' | 'mediaPath'; currentPath: string }>({
|
||||||
|
|||||||
Reference in new issue
Block a user