feat(core): score by distance from target size (#63)
ci / web (push) Successful in 48s
ci / rust (push) Successful in 1m13s
e2e / e2e (push) Successful in 1m15s

This commit was merged in pull request #63.
This commit is contained in:
2026-08-22 21:15:26 +01:00
parent 514628f089
commit 29d6831c83
5 changed files with 494 additions and 8 deletions
+12
View File
@@ -6,8 +6,10 @@ use std::{collections::BTreeMap, path::PathBuf, time::SystemTime};
pub mod lang;
pub mod policy;
pub mod score;
pub use arr_parse::NameClaims as ParsedRelease;
pub use score::{Score, ScoreWeights};
macro_rules! id_type {
($name:ident) => {
@@ -124,10 +126,19 @@ pub struct HdrRules {
pub rejected_dolby_vision_profiles: Vec<DolbyVisionProfile>,
}
/// One resolution's size band (`DESIGN.md` §5.5). Below the floor is a hard
/// filter; the target is where the score peaks; above it the penalty grows
/// with every gibibyte.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct SizeBand {
pub floor_bytes: u64,
pub target_bytes: u64,
/// Points lost per gibibyte above `target_bytes`, on the scale set by
/// [`ScoreWeights::size_at_target`] — 1000 points at target means one
/// point is a tenth of a percent, fine enough to tune by hand without a
/// fractional type. Applied per byte over, so a partial gibibyte costs
/// its fraction.
pub penalty_points_per_gib_over: i32,
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -140,6 +151,7 @@ pub struct Policy {
pub size_bands: BTreeMap<Resolution, SizeBand>,
pub resolution_preference: Vec<Resolution>,
pub source_weights: BTreeMap<Source, i32>,
pub score_weights: ScoreWeights,
}
#[derive(Clone, Debug, Default, Eq, PartialEq)]