Files
arr/crates/arr-db/migrations/0002_seed_movie_roots.sql
T
naps62-yolo 84777169d0
ci / web (push) Successful in 7s
ci / rust (push) Successful in 35s
e2e / e2e (push) Successful in 47s
feat(db): SQLite schema and movie migrations (#48)
2026-08-22 19:36:39 +01:00

46 lines
2.4 KiB
SQL

-- The two movie roots and their policies, DESIGN.md §5.1. Paths follow §7.4:
-- media kind first, audience second.
--
-- Policy lives in the database rather than config (§10) because these numbers
-- get tuned by hand. The size bands are placeholders pending the remux
-- playback test in §14; the model is the decision, not the constants.
INSERT INTO policies (
name, required_audio, dub_blacklist, hdr_rules,
size_bands, resolution_pref, source_weights
) VALUES (
'Movies — main',
-- §5.2. Require a track in the title's own original language. Anything
-- else may ride along.
json('{"require":"original_language","allow_english_fallback":false}'),
json('["pt-BR"]'),
-- §5.3. Profile 5 has no HDR10 base layer and Profile 7 depends on the
-- player. Profile 8.1 plays as HDR10 and is fine.
json('{"dv_profile_allow":["8.1"],"dv_profile_reject":["5","7"],"allow_hdr10":true,"allow_hdr10plus":true,"allow_sdr":true}'),
-- Floors matter: unbounded "smaller is better" picks a 3 GB 4K encode
-- that looks like mud.
json('{"2160p":{"floor_gb":8,"target_gb":22,"penalty_per_gb_over":0.5},"1080p":{"floor_gb":3,"target_gb":8,"penalty_per_gb_over":0.5}}'),
json('["2160p","1080p"]'),
json('{"Remux":4,"BluRay":3,"WEB-DL":2,"WEBRip":1,"HDTV":0}')
), (
'Movies — kids',
-- §5.2. pt-PT, or the original language when that is already Portuguese.
-- pt-BR never satisfies this.
json('{"require":"any_of","langs":["pt-PT"],"or_original_when_portuguese":true,"allow_english_fallback":false}'),
json('["pt-BR"]'),
json('{"dv_profile_allow":["8.1"],"dv_profile_reject":["5","7"],"allow_hdr10":true,"allow_hdr10plus":true,"allow_sdr":true}'),
json('{"2160p":{"floor_gb":8,"target_gb":22,"penalty_per_gb_over":0.5},"1080p":{"floor_gb":3,"target_gb":8,"penalty_per_gb_over":0.5}}'),
json('["2160p","1080p"]'),
-- §5.2. European Portuguese dubs live in streaming WEB-DLs and
-- essentially never in BluRay encodes, so this root biases hard that way.
json('{"WEB-DL":4,"WEBRip":2,"BluRay":1,"Remux":1,"HDTV":0}')
);
INSERT INTO roots (kind, audience, path, policy_id)
SELECT 'movie', 'main', '/mnt/media/movies/main', id
FROM policies WHERE name = 'Movies — main';
INSERT INTO roots (kind, audience, path, policy_id)
SELECT 'movie', 'kids', '/mnt/media/movies/kids', id
FROM policies WHERE name = 'Movies — kids';