Release list: filter by quality, codec, HDR, DV and language
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,3 +47,27 @@ func TestAttrsVariants(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestReleaseAttrs(t *testing.T) {
|
||||
var r Release
|
||||
raw := `{"title":"Dune.2021.2160p.UHD.BluRay.DV.HDR10.x265-GRP","quality":{"quality":{"name":"Bluray-2160p","resolution":2160}},
|
||||
"languages":[{"name":"English"}],"customFormats":[{"name":"HDR"}]}`
|
||||
if err := json.Unmarshal([]byte(raw), &r); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := FileAttrs{Resolution: 2160, Codec: CodecX265, HDR: true, DV: true, Languages: []string{"English"}}
|
||||
if got := r.Attrs(); !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("got %+v, want %+v", got, want)
|
||||
}
|
||||
|
||||
// Resolution from the title when the quality carries none; codec spelled H.264.
|
||||
r = Release{Title: "Show.S01E01.720p.WEB.H.264-GRP"}
|
||||
if got := r.Attrs(); got.Resolution != 720 || got.Codec != CodecX264 || got.HDR || got.DV {
|
||||
t.Errorf("got %+v", got)
|
||||
}
|
||||
// "HDTV" and "HDRip" are not HDR.
|
||||
r = Release{Title: "Show.S01E01.HDTV.x264-GRP"}
|
||||
if got := r.Attrs(); got.HDR || got.DV {
|
||||
t.Errorf("HDTV detected as HDR: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user