This commit is contained in:
ponzischeme89
2026-08-21 22:40:31 +12:00
parent 32019f2e20
commit c85fab4459
15 changed files with 417 additions and 248 deletions
+9 -4
View File
@@ -134,14 +134,13 @@ var preferenceCatalogue = []preferenceDefinition{
// This is operator-owned because the hero is a shared piece of the launcher's
// composition, not a per-television preference. The multi value keeps its order.
Key: "metadataHeroContentOrder", Name: "Metadata hero content order", Area: "Home layout",
Description: "The order of title, ratings, facts, genre and plot summary in the focused metadata hero.",
Description: "The order of title, ratings, metadata information and plot summary in the focused metadata hero.",
Kind: preferenceMulti, AdminOnly: true,
Default: []string{"title", "ratings", "facts", "genres", "summary"},
Default: []string{"title", "ratings", "facts", "summary"},
Options: []preferenceOption{
option("title", "Movie logo or title"),
option("ratings", "Ratings"),
option("facts", "Metadata facts"),
option("genres", "Genre"),
option("facts", "Metadata information"),
option("summary", "Plot summary"),
},
},
@@ -337,6 +336,12 @@ func normalizePreference(definition preferenceDefinition, value any) any {
if selected := stringList(value); len(selected) > 0 {
kept := []string{}
for _, entry := range selected {
// Genre used to be a separate metadata-hero block. It now lives inside
// Metadata information with runtime and the sound/video badges. Map the
// stored token instead of silently removing that block from existing users.
if definition.Key == "metadataHeroContentOrder" && entry == "genres" {
entry = "facts"
}
if hasOption(definition.Options, entry) && !slices.Contains(kept, entry) {
kept = append(kept, entry)
}
+10
View File
@@ -126,6 +126,16 @@ func TestNormalizePreferencesKeepsMultiOrderAndDedupes(t *testing.T) {
}
}
func TestNormalizePreferencesFoldsLegacyGenreIntoMetadataInformation(t *testing.T) {
result := normalizePreferences(map[string]any{
"metadataHeroContentOrder": []any{"title", "ratings", "genres", "summary"},
})
want := []string{"title", "ratings", "facts", "summary"}
if !reflect.DeepEqual(result["metadataHeroContentOrder"], want) {
t.Errorf("metadataHeroContentOrder = %v, want %v", result["metadataHeroContentOrder"], want)
}
}
// Free-form row ids are stored newline-separated on the television, so an id containing
// one would come back as two rows on the next sync.
func TestNormalizePreferencesRejectsNewlinesInRowIds(t *testing.T) {