Series drill-down: season posters

The drill-down reads the series with includeSeasonImages=true (Sonarr
only sends season posters when asked, as TheTVDB links). A selected
season or episode shows its season's poster; without one, or when it
cannot be loaded, the series poster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 23:42:49 +02:00
co-authored by Claude Opus 5.5
parent 73efe279d4
commit ca28a3c9bb
7 changed files with 92 additions and 2 deletions
+20
View File
@@ -198,3 +198,23 @@ func TestCalendar(t *testing.T) {
t.Errorf("episode not decoded: %+v", e)
}
}
func TestGetSeriesAsksForSeasonPosters(t *testing.T) {
var query string
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
query = r.URL.RawQuery
w.Write([]byte(`{"id":7,"title":"Andor","seasons":[{"seasonNumber":1,"monitored":true,
"images":[{"coverType":"poster","remoteUrl":"https://artworks.thetvdb.com/banners/seasons/1.jpg"}]}]}`))
}))
defer srv.Close()
s, err := NewClient(srv.URL, "k").GetSeries(t.Context(), 7)
if err != nil {
t.Fatal(err)
}
if query != "includeSeasonImages=true" {
t.Errorf("query %q", query)
}
if len(s.Seasons) != 1 || len(s.Seasons[0].Images) != 1 || s.Seasons[0].Images[0].RemoteURL == "" {
t.Errorf("season images %+v", s.Seasons)
}
}