Filter by audio format; apply filter changes live behind the dialog

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 20:36:26 +02:00
co-authored by Claude Sonnet 5.5
parent 47b9459a5e
commit 6b780242c9
9 changed files with 167 additions and 27 deletions
+41
View File
@@ -71,3 +71,44 @@ func TestReleaseAttrs(t *testing.T) {
t.Errorf("HDTV detected as HDR: %+v", got)
}
}
func TestAudioTags(t *testing.T) {
for _, tc := range []struct {
in string
want []string
}{
{"Movie.2160p.UHD.BluRay.TrueHD.7.1.Atmos.x265-G", []string{"Atmos", "TrueHD"}},
{"Movie.1080p.DDP5.1.Atmos.x265", []string{"Atmos", "DD+"}},
{"Movie.1080p.DTS-HD.MA.5.1.x264", []string{"DTS-HD", "DTS"}},
{"Movie.2160p.DTS-X.7.1", []string{"DTS:X", "DTS"}},
{"Movie.1080p.DTS.5.1", []string{"DTS"}},
{"Movie.1080p.EAC3.5.1", []string{"DD+"}},
{"Movie.1080p.E-AC-3.5.1", []string{"DD+"}},
{"Movie.1080p.AC3.5.1", []string{"DD"}},
{"Movie.720p.DD5.1.x264", []string{"DD"}},
{"Show.S01E01.AAC.2.0", []string{"AAC"}},
{"Album.FLAC", []string{"FLAC"}},
{"Show.Opus", []string{"Opus"}},
{"Movie.1080p.BluRay.x264-DTSAG", nil}, // a group name is not an audio format
{"Movie.1080p.x264", nil},
} {
if got := audioTags(tc.in); !reflect.DeepEqual(got, tc.want) {
t.Errorf("audioTags(%q) = %v, want %v", tc.in, got, tc.want)
}
}
}
func TestMediaFileAudio(t *testing.T) {
a := attrs(t, `{"sceneName":"Movie.x264.AC3","mediaInfo":{"audioCodec":"TrueHD Atmos"}}`)
if !reflect.DeepEqual(a.Audio, []string{"Atmos", "TrueHD"}) {
t.Errorf("media info wins over the name: %v", a.Audio)
}
a = attrs(t, `{"mediaInfo":{"audioCodec":"EAC3","audioAdditionalFeatures":"Atmos"}}`)
if !reflect.DeepEqual(a.Audio, []string{"Atmos", "DD+"}) {
t.Errorf("additional features: %v", a.Audio)
}
a = attrs(t, `{"relativePath":"Movie.1080p.DTS-HD.MA.mkv"}`)
if !reflect.DeepEqual(a.Audio, []string{"DTS-HD", "DTS"}) {
t.Errorf("fallback to the name: %v", a.Audio)
}
}