feat(arr): add subtitle_settings table
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
-- #198. The runtime-editable half of subtitle configuration (DESIGN.md §15,
|
||||
-- §10). The other half — provider credentials, translator keys, the
|
||||
-- remote-command template, the alass and ffmpeg binary paths — is
|
||||
-- config/env only and never reaches this table.
|
||||
--
|
||||
-- One row: the wanted set, enabled providers and translation engine are
|
||||
-- global, not per root (§15), so there is nothing to key this on.
|
||||
|
||||
CREATE TABLE subtitle_settings (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1),
|
||||
-- Language tags as `arr_core::Language` spells them, e.g. `pt-PT`, `en`.
|
||||
wanted_languages TEXT NOT NULL DEFAULT '["pt-PT","en"]'
|
||||
CHECK (json_valid(wanted_languages)),
|
||||
-- Provider ids in search order (DESIGN.md §15's ranking runs per
|
||||
-- provider before it runs per candidate). Absent from the array means
|
||||
-- disabled.
|
||||
providers_enabled TEXT NOT NULL DEFAULT '["opensubtitles","podnapisi"]'
|
||||
CHECK (json_valid(providers_enabled)),
|
||||
-- The compiled-in backend in use, or NULL when translation is off. Not
|
||||
-- checked against the running binary's features here — the API does
|
||||
-- that (#198) — so a rebuild with a different feature set never leaves
|
||||
-- an unreadable row.
|
||||
translation_engine TEXT
|
||||
CHECK (translation_engine IN ('openai', 'deepl', 'google', 'command')),
|
||||
-- Provider id / engine name -> a daily allowance (§15's token buckets,
|
||||
-- #197). A missing key means no allowance configured yet, not zero.
|
||||
provider_daily_budgets TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(provider_daily_budgets)),
|
||||
translator_daily_budgets TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(translator_daily_budgets)),
|
||||
-- Only the remote-command backend needs one of these: the HTTP backends
|
||||
-- carry their own client timeout.
|
||||
remote_command_timeout_seconds INTEGER NOT NULL DEFAULT 30
|
||||
CHECK (remote_command_timeout_seconds > 0),
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
||||
) STRICT;
|
||||
|
||||
INSERT INTO subtitle_settings (id) VALUES (1);
|
||||
Reference in New Issue
Block a user