add schema migrations for unified pipeline: confidence, apple_compat, job_type, transcode_codec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 01:41:48 +01:00
parent c017ca09d4
commit c2e5b70b02
5 changed files with 25 additions and 10 deletions

View File

@@ -57,7 +57,13 @@ export function getDb(): Database {
try { _db.exec("ALTER TABLE nodes ADD COLUMN movies_path TEXT NOT NULL DEFAULT ''"); } catch { /* already exists */ }
try { _db.exec("ALTER TABLE nodes ADD COLUMN series_path TEXT NOT NULL DEFAULT ''"); } catch { /* already exists */ }
try { _db.exec("ALTER TABLE jobs ADD COLUMN job_type TEXT NOT NULL DEFAULT 'audio'"); } catch { /* already exists */ }
// Apple compat pipeline columns
try { _db.exec("ALTER TABLE review_plans ADD COLUMN confidence TEXT NOT NULL DEFAULT 'low'"); } catch { /* already exists */ }
try { _db.exec('ALTER TABLE review_plans ADD COLUMN apple_compat TEXT'); } catch { /* already exists */ }
try { _db.exec("ALTER TABLE review_plans ADD COLUMN job_type TEXT NOT NULL DEFAULT 'copy'"); } catch { /* already exists */ }
try { _db.exec('ALTER TABLE stream_decisions ADD COLUMN transcode_codec TEXT'); } catch { /* already exists */ }
seedDefaults(_db);
return _db;
}

View File

@@ -129,4 +129,8 @@ export const DEFAULT_CONFIG: Record<string, string> = {
audio_languages: '[]',
scan_running: '0',
job_sleep_seconds: '0',
schedule_enabled: '0',
schedule_start: '01:00',
schedule_end: '07:00',
};

View File

@@ -9,12 +9,6 @@ const APPLE_COMPATIBLE_AUDIO = new Set([
'opus',
]);
// Lossless source codecs — get FLAC in MKV, EAC3 in MP4
const LOSSLESS_CODECS = new Set([
'dts', // DTS-HD MA reports as 'dts' with profile
'truehd',
]);
// Codec strings Jellyfin may report for DTS variants
const DTS_CODECS = new Set([
'dts', 'dca',

View File

@@ -48,6 +48,9 @@ export interface ReviewPlan {
item_id: number;
status: 'pending' | 'approved' | 'skipped' | 'done' | 'error';
is_noop: number;
confidence: 'high' | 'low';
apple_compat: 'direct_play' | 'remux' | 'audio_transcode' | null;
job_type: 'copy' | 'transcode';
subs_extracted: number;
notes: string | null;
reviewed_at: string | null;
@@ -73,13 +76,14 @@ export interface StreamDecision {
action: 'keep' | 'remove';
target_index: number | null;
custom_title: string | null;
transcode_codec: string | null;
}
export interface Job {
id: number;
item_id: number;
command: string;
job_type: 'audio' | 'subtitle';
job_type: 'copy' | 'transcode';
node_id: number | null;
status: 'pending' | 'running' | 'done' | 'error';
output: string | null;
@@ -115,8 +119,11 @@ export interface StreamWithDecision extends MediaStream {
export interface PlanResult {
is_noop: boolean;
has_subs: boolean;
decisions: Array<{ stream_id: number; action: 'keep' | 'remove'; target_index: number | null }>;
notes: string | null;
confidence: 'high' | 'low';
apple_compat: 'direct_play' | 'remux' | 'audio_transcode' | null;
job_type: 'copy' | 'transcode';
decisions: Array<{ stream_id: number; action: 'keep' | 'remove'; target_index: number | null; transcode_codec: string | null }>;
notes: string[];
}
// ─── Jellyfin API types ───────────────────────────────────────────────────────

View File

@@ -46,6 +46,9 @@ export interface ReviewPlan {
item_id: number;
status: string;
is_noop: number;
confidence: 'high' | 'low';
apple_compat: 'direct_play' | 'remux' | 'audio_transcode' | null;
job_type: 'copy' | 'transcode';
subs_extracted: number;
notes: string | null;
reviewed_at: string | null;
@@ -71,6 +74,7 @@ export interface StreamDecision {
action: 'keep' | 'remove';
target_index: number | null;
custom_title: string | null;
transcode_codec: string | null;
}
export interface Job {
@@ -78,7 +82,7 @@ export interface Job {
item_id: number;
node_id: number | null;
command: string;
job_type: 'audio' | 'subtitle';
job_type: 'copy' | 'transcode';
status: 'pending' | 'running' | 'done' | 'error';
output: string | null;
exit_code: number | null;