0.12.0-7 remove legacy
This commit is contained in:
+18
-197
@@ -790,7 +790,24 @@ async function removeDeprecatedSettings(db) {
|
||||
'filename_template_dvd',
|
||||
'output_folder_template_bluray',
|
||||
'output_folder_template_dvd',
|
||||
'output_extension_audiobook'
|
||||
'output_extension_audiobook',
|
||||
'use_plugin_architecture',
|
||||
'use_plugin_architecture_bluray',
|
||||
'use_plugin_architecture_bluray_analyze',
|
||||
'use_plugin_architecture_bluray_rip',
|
||||
'use_plugin_architecture_bluray_review',
|
||||
'use_plugin_architecture_bluray_encode',
|
||||
'use_plugin_architecture_dvd',
|
||||
'use_plugin_architecture_dvd_analyze',
|
||||
'use_plugin_architecture_dvd_rip',
|
||||
'use_plugin_architecture_dvd_review',
|
||||
'use_plugin_architecture_dvd_encode',
|
||||
'use_plugin_architecture_cd',
|
||||
'use_plugin_architecture_cd_analyze',
|
||||
'use_plugin_architecture_cd_rip',
|
||||
'use_plugin_architecture_audiobook',
|
||||
'use_plugin_architecture_audiobook_analyze',
|
||||
'use_plugin_architecture_audiobook_encode'
|
||||
];
|
||||
for (const key of deprecatedKeys) {
|
||||
const schemaResult = await db.run('DELETE FROM settings_schema WHERE key = ?', [key]);
|
||||
@@ -996,202 +1013,6 @@ async function migrateSettingsSchemaMetadata(db) {
|
||||
}
|
||||
}
|
||||
|
||||
// Plugin-Architektur Toggle (Phase 2) — hierarchisch mit depends_on
|
||||
// Struktur: global → medium (depends_on: global) → phase (depends_on: medium)
|
||||
//
|
||||
// Implementierungsstand:
|
||||
// ✅ = plugin-pfad aktiv ⏳ = noch nicht implementiert (readonly, immer aus)
|
||||
//
|
||||
// BluRay / DVD: Analyse ✅ Rip ✅ Review ⏳ Encode ⏳
|
||||
// CD: Analyse ✅ Rip ✅
|
||||
// Audiobook: Analyse ✅ Encode ⏳
|
||||
|
||||
const pluginArchitectureSettings = [
|
||||
// ── Global ──────────────────────────────────────────────────────────────
|
||||
{
|
||||
key: 'use_plugin_architecture',
|
||||
label: 'Neue Plugin-Architektur (Beta)',
|
||||
description: 'Masterschalter: Aktiviert die neue modulare Plugin-Architektur (Phase 2). Alle Medium-Schalter darunter sind nur wirksam wenn dieser aktiv ist.',
|
||||
defaultValue: 'false',
|
||||
orderIndex: 9999,
|
||||
dependsOn: null,
|
||||
validationJson: '{}'
|
||||
},
|
||||
// ── Blu-ray ──────────────────────────────────────────────────────────────
|
||||
{
|
||||
key: 'use_plugin_architecture_bluray',
|
||||
label: 'Blu-ray Plugin',
|
||||
description: 'Aktiviert das Blu-ray Plugin. Deaktiviert = Legacy-Pfad für alle Blu-ray-Phasen.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10000,
|
||||
dependsOn: 'use_plugin_architecture',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_bluray_analyze',
|
||||
label: 'Analyse (Blu-ray)',
|
||||
description: 'Disc-Erkennung und OMDB-Suche laufen über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10001,
|
||||
dependsOn: 'use_plugin_architecture_bluray',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_bluray_rip',
|
||||
label: 'Rip (Blu-ray)',
|
||||
description: 'MakeMKV-Rip läuft über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10002,
|
||||
dependsOn: 'use_plugin_architecture_bluray',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_bluray_review',
|
||||
label: 'Review / Mediainfo-Prüfung (Blu-ray)',
|
||||
description: 'HandBrake-Scan läuft über das Blu-ray-Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10003,
|
||||
dependsOn: 'use_plugin_architecture_bluray',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_bluray_encode',
|
||||
label: 'Encoding (Blu-ray)',
|
||||
description: 'Encoding läuft über das Blu-ray-Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10004,
|
||||
dependsOn: 'use_plugin_architecture_bluray',
|
||||
validationJson: '{}'
|
||||
},
|
||||
// ── DVD ──────────────────────────────────────────────────────────────────
|
||||
{
|
||||
key: 'use_plugin_architecture_dvd',
|
||||
label: 'DVD Plugin',
|
||||
description: 'Aktiviert das DVD Plugin. Deaktiviert = Legacy-Pfad für alle DVD-Phasen.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10010,
|
||||
dependsOn: 'use_plugin_architecture',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_dvd_analyze',
|
||||
label: 'Analyse (DVD)',
|
||||
description: 'Disc-Erkennung und OMDB-Suche laufen über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10011,
|
||||
dependsOn: 'use_plugin_architecture_dvd',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_dvd_rip',
|
||||
label: 'Rip (DVD)',
|
||||
description: 'MakeMKV-Rip läuft über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10012,
|
||||
dependsOn: 'use_plugin_architecture_dvd',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_dvd_review',
|
||||
label: 'Review / Mediainfo-Prüfung (DVD)',
|
||||
description: 'Review-/Track-Analyse läuft über das DVD-Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10013,
|
||||
dependsOn: 'use_plugin_architecture_dvd',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_dvd_encode',
|
||||
label: 'Encoding (DVD)',
|
||||
description: 'Encoding läuft über das DVD-Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10014,
|
||||
dependsOn: 'use_plugin_architecture_dvd',
|
||||
validationJson: '{}'
|
||||
},
|
||||
// ── Audio-CD ─────────────────────────────────────────────────────────────
|
||||
{
|
||||
key: 'use_plugin_architecture_cd',
|
||||
label: 'Audio-CD Plugin',
|
||||
description: 'Aktiviert das Audio-CD Plugin. Deaktiviert = Legacy-Pfad für alle CD-Phasen.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10020,
|
||||
dependsOn: 'use_plugin_architecture',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_cd_analyze',
|
||||
label: 'Analyse (Audio-CD)',
|
||||
description: 'TOC-Auslesung läuft über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10021,
|
||||
dependsOn: 'use_plugin_architecture_cd',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_cd_rip',
|
||||
label: 'Rip (Audio-CD)',
|
||||
description: 'CD-Rip/RAW-Rip/Encode-aus-RAW läuft über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10022,
|
||||
dependsOn: 'use_plugin_architecture_cd',
|
||||
validationJson: '{}'
|
||||
},
|
||||
// ── Audiobook ────────────────────────────────────────────────────────────
|
||||
{
|
||||
key: 'use_plugin_architecture_audiobook',
|
||||
label: 'Audiobook Plugin',
|
||||
description: 'Aktiviert das Audiobook Plugin. Deaktiviert = Legacy-Pfad für alle Audiobook-Phasen.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10030,
|
||||
dependsOn: 'use_plugin_architecture',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_audiobook_analyze',
|
||||
label: 'Analyse (Audiobook)',
|
||||
description: 'ffprobe-Metadatenanalyse läuft über das Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10031,
|
||||
dependsOn: 'use_plugin_architecture_audiobook',
|
||||
validationJson: '{}'
|
||||
},
|
||||
{
|
||||
key: 'use_plugin_architecture_audiobook_encode',
|
||||
label: 'Encoding (Audiobook)',
|
||||
description: 'Encoding läuft über das Audiobook-Plugin.',
|
||||
defaultValue: 'true',
|
||||
orderIndex: 10032,
|
||||
dependsOn: 'use_plugin_architecture_audiobook',
|
||||
validationJson: '{}'
|
||||
}
|
||||
];
|
||||
for (const setting of pluginArchitectureSettings) {
|
||||
await db.run(
|
||||
`INSERT OR IGNORE INTO settings_schema (key, category, label, type, required, description, default_value, options_json, validation_json, order_index, depends_on)
|
||||
VALUES (?, 'Erweitert', ?, 'boolean', 1, ?, ?, '[]', ?, ?, ?)`,
|
||||
[setting.key, setting.label, setting.description, setting.defaultValue, setting.validationJson, setting.orderIndex, setting.dependsOn ?? null]
|
||||
);
|
||||
// depends_on und order_index für bereits existierende Zeilen aktualisieren
|
||||
await db.run(
|
||||
`UPDATE settings_schema SET depends_on = ?, order_index = ?, validation_json = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE key = ? AND (depends_on IS NOT ? OR order_index != ? OR validation_json != ?)`,
|
||||
[setting.dependsOn ?? null, setting.orderIndex, setting.validationJson, setting.key, setting.dependsOn ?? null, setting.orderIndex, setting.validationJson]
|
||||
);
|
||||
await db.run(
|
||||
`UPDATE settings_schema
|
||||
SET label = ?, description = ?, default_value = ?, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE key = ?
|
||||
AND (label != ? OR description != ? OR COALESCE(default_value, '') != COALESCE(?, ''))`,
|
||||
[setting.label, setting.description, setting.defaultValue, setting.key, setting.label, setting.description, setting.defaultValue]
|
||||
);
|
||||
await db.run(`INSERT OR IGNORE INTO settings_values (key, value) VALUES (?, ?)`, [setting.key, setting.defaultValue]);
|
||||
// Readonly-Toggles immer auf 'false' zurücksetzen (nie aktivierbar)
|
||||
if (setting.validationJson === '{"readonly":true}') {
|
||||
await db.run(`UPDATE settings_values SET value = 'false' WHERE key = ?`, [setting.key]);
|
||||
}
|
||||
}
|
||||
|
||||
await db.run(`
|
||||
CREATE TABLE IF NOT EXISTS user_prefs (
|
||||
key TEXT PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user