Files
arr/crates/arr-db/migrations/0035_resolution_tiers.sql
T
Miguel PalhasandClaude Opus 5.5 cd9e8a891c
ci / web (push) Successful in 1m3s
e2e / e2e (push) Failing after 1m37s
ci / rust (push) Successful in 2m21s
ci / image (push) Successful in 2m33s
feat: rank 4K first, fall back to good 1080p
Resolution preference becomes strict tiers (step 10 000) and every
size band gains a ceiling that waives bloated releases, so a 60 GB
remux cannot win the top tier unattended. Movie grab, TV grab, RSS
and the search deck now share one ranking key from arr-core.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-07 18:02:12 +00:00

36 lines
1.6 KiB
SQL

-- §5.4: 4K if there is any, otherwise a good 1080p. The resolution step was
-- 300 points, small enough that an on-target 1080p outranked a 4K a few
-- gibibytes off its own target. 10 000 dwarfs every other term, so the
-- preference list reads as tiers and the size, source and seeder terms only
-- order releases inside one.
--
-- With strict tiers a bloated 4K remux would beat every 1080p, so each band
-- gains a ceiling. Above it a release is waived: never picked automatically,
-- still a manual grab. Twice the target for 4K and two and a half times for
-- 1080p, which on the seeded bands is 44 GiB and 20 GiB for movies, 12 GiB
-- and 5 GiB per episode for TV. A band that already carries a ceiling keeps
-- it.
UPDATE policies
SET score_weights = json_set(score_weights, '$.resolution_step', 10000),
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now');
UPDATE policies
SET size_bands = json_set(
size_bands,
'$."2160p".ceiling_gib',
json_extract(size_bands, '$."2160p".target_gib') * 2
),
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE json_extract(size_bands, '$."2160p"') IS NOT NULL
AND json_extract(size_bands, '$."2160p".ceiling_gib') IS NULL;
UPDATE policies
SET size_bands = json_set(
size_bands,
'$."1080p".ceiling_gib',
CAST(json_extract(size_bands, '$."1080p".target_gib') * 5 / 2 AS INTEGER)
),
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE json_extract(size_bands, '$."1080p"') IS NOT NULL
AND json_extract(size_bands, '$."1080p".ceiling_gib') IS NULL;