Add backwards-compatible specialist overview style metadata

This commit is contained in:
Sleeps
2026-10-08 16:17:09 +01:00
parent 5e9e4d72e4
commit 1b8714b0f6
+15
View File
@@ -104,6 +104,7 @@ CREATE TABLE IF NOT EXISTS jellyfin_overview_drafts (
jellyfin_item_id TEXT NOT NULL, jellyfin_item_id TEXT NOT NULL,
overview TEXT NOT NULL, overview TEXT NOT NULL,
model TEXT NOT NULL, model TEXT NOT NULL,
style TEXT NOT NULL DEFAULT 'general',
caption_fingerprint TEXT NOT NULL, caption_fingerprint TEXT NOT NULL,
sampled_captions INTEGER NOT NULL, sampled_captions INTEGER NOT NULL,
original_overview TEXT, original_overview TEXT,
@@ -179,11 +180,25 @@ def _ensure_frame_caption_columns(con: sqlite3.Connection) -> None:
) )
def _ensure_overview_columns(con: sqlite3.Connection) -> None:
"""Upgrade existing overview drafts without dropping publish/restore backups."""
columns = {
row["name"]
for row in con.execute("PRAGMA table_info(jellyfin_overview_drafts)")
}
if "style" not in columns:
con.execute(
"ALTER TABLE jellyfin_overview_drafts "
"ADD COLUMN style TEXT NOT NULL DEFAULT 'general'"
)
def init_db(path: Path) -> None: def init_db(path: Path) -> None:
with connect(path) as con: with connect(path) as con:
con.executescript(SCHEMA) con.executescript(SCHEMA)
_ensure_media_jellyfin_columns(con) _ensure_media_jellyfin_columns(con)
_ensure_frame_caption_columns(con) _ensure_frame_caption_columns(con)
_ensure_overview_columns(con)
def pack_vector(vector: np.ndarray) -> bytes: def pack_vector(vector: np.ndarray) -> bytes: