Show poster thumbnails in the detail panes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 21:47:50 +02:00
co-authored by Claude Sonnet 5.5
parent ff204655d3
commit a4303ed3ca
15 changed files with 724 additions and 22 deletions
+7
View File
@@ -28,8 +28,15 @@ type Arr struct {
// UI holds interface settings.
type UI struct {
RefreshSeconds int `json:"refresh_seconds,omitempty"`
// Covers shows poster thumbnails in the detail panes (default true).
// Posters of titles that are not in the library yet are downloaded from
// the public image hosts Radarr/Sonarr point to (TMDb, TheTVDB).
Covers *bool `json:"covers,omitempty"`
}
// ShowCovers reports whether poster thumbnails are enabled.
func (u UI) ShowCovers() bool { return u.Covers == nil || *u.Covers }
// Config is the full application configuration.
type Config struct {
Radarr Arr `json:"radarr"`
+21
View File
@@ -76,3 +76,24 @@ func TestLoadPermissionWarning(t *testing.T) {
t.Fatalf("unexpected warnings: %v", warnings)
}
}
func TestShowCovers(t *testing.T) {
base := `{"radarr":{"url":"http://r","apikey":"k"},"sonarr":{"url":"http://s","apikey":"k"},"sabnzbd":{"url":"http://a","apikey":"k"}`
for _, tc := range []struct {
ui string
want bool
}{
{``, true},
{`,"ui":{}`, true},
{`,"ui":{"covers":true}`, true},
{`,"ui":{"covers":false}`, false},
} {
cfg, err := Parse([]byte(base + tc.ui + `}`))
if err != nil {
t.Fatal(err)
}
if got := cfg.UI.ShowCovers(); got != tc.want {
t.Errorf("%q: ShowCovers = %v, want %v", tc.ui, got, tc.want)
}
}
}