remove path mappings, add subtitle summary endpoint, cache setup page, bump version
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m50s
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m50s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@ const ENV_MAP: Record<string, string> = {
|
||||
sonarr_enabled: 'SONARR_ENABLED',
|
||||
subtitle_languages: 'SUBTITLE_LANGUAGES',
|
||||
audio_languages: 'AUDIO_LANGUAGES',
|
||||
path_mappings: 'PATH_MAPPINGS',
|
||||
|
||||
};
|
||||
|
||||
/** Read a config key from environment variables (returns null if not set). */
|
||||
@@ -34,7 +34,6 @@ function envValue(key: string): string | null {
|
||||
if (!val) return null;
|
||||
if (key.endsWith('_enabled')) return val === '1' || val.toLowerCase() === 'true' ? '1' : '0';
|
||||
if (key === 'subtitle_languages' || key === 'audio_languages') return JSON.stringify(val.split(',').map((s) => s.trim()));
|
||||
if (key === 'path_mappings') return JSON.stringify(val.split(',').map((pair) => { const [from, to] = pair.split('='); return [from?.trim(), to?.trim()]; }).filter(([f, t]) => f && t));
|
||||
if (key.endsWith('_url')) return val.replace(/\/$/, '');
|
||||
return val;
|
||||
}
|
||||
@@ -112,27 +111,3 @@ export function getAllConfig(): Record<string, string> {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPathMappings(): [string, string][] {
|
||||
const raw = getConfig('path_mappings');
|
||||
if (!raw) return [];
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed.filter(([f, t]: [string, string]) => f && t) : [];
|
||||
} catch { return []; }
|
||||
}
|
||||
|
||||
/** Apply path_mappings config to translate a Jellyfin path to a local container path. */
|
||||
export function applyPathMappings(path: string): string {
|
||||
for (const [from, to] of getPathMappings()) {
|
||||
if (path.startsWith(from)) return to + path.slice(from.length);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/** Apply all path_mappings as replaceAll on a command string (for baked-in paths). */
|
||||
export function applyPathMappingsToCommand(cmd: string): string {
|
||||
for (const [from, to] of getPathMappings()) {
|
||||
cmd = cmd.replaceAll(from, to);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user