fix(web): one language chip per file, not per track
Commentary tracks carry the same language as the feature audio, so a file row rendered `en` two or three times. The chips answer what a file can be watched in; repeats say nothing the first said.
This commit is contained in:
+7
-1
@@ -357,6 +357,8 @@ export function bucketOf(release: MovieRelease): Bucket {
|
||||
* The probed attributes a file row shows as chips (§5.6, §7.4) — ffprobe
|
||||
* truth, not name claims. Shared by movie and episode file rows; the probe
|
||||
* JSON arrives untyped from the API, so the shape is narrowed here.
|
||||
*
|
||||
* Audio is reported as the set of languages present, one chip each.
|
||||
*/
|
||||
export function probedAttributeTags(probed: unknown): string[] {
|
||||
if (probed === null || typeof probed !== "object") {
|
||||
@@ -378,11 +380,15 @@ export function probedAttributeTags(probed: unknown): string[] {
|
||||
if (probe.hdr && probe.hdr !== "SDR") {
|
||||
tags.push(probe.hdr);
|
||||
}
|
||||
// Set, not push: commentary tracks repeat the feature audio's language,
|
||||
// and no test catches a row that renders `en` three times.
|
||||
const languages = new Set<string>();
|
||||
for (const track of probe.audio_tracks ?? []) {
|
||||
if (track.language) {
|
||||
tags.push(track.language);
|
||||
languages.add(track.language);
|
||||
}
|
||||
}
|
||||
tags.push(...languages);
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user