fix(client): copy Art.URL into ContainerArt when storing preset

StoreCurrentAsPreset only used ContentItem.ContainerArt for the stored
artwork URL. For Spotify (and some other streaming sources) the speaker
populates the top-level NowPlaying.Art.URL field instead, leaving
ContainerArt empty, which caused preset tiles to show as text-only.

When ContainerArt is empty and Art.URL is present with artImageStatus
IMAGE_PRESENT, copy the URL into a shallow-copy of the ContentItem
before storing it. Devices where ContainerArt is already set are
unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-05-26 22:47:13 +02:00
co-authored by Claude Sonnet 4.6
parent d28c806903
commit ab5bd82fbc
+13 -1
View File
@@ -424,7 +424,19 @@ func (c *Client) StoreCurrentAsPreset(id int) error {
return fmt.Errorf("current content cannot be saved as preset")
}
return c.StorePreset(id, nowPlaying.ContentItem)
// Streaming services (Spotify, TuneIn, …) put the artwork URL in the
// top-level <art> element of the now-playing response, not inside
// ContentItem.containerArt. Copy it over before storing so the preset
// slot shows the album/station cover image.
ci := *nowPlaying.ContentItem // shallow copy — no pointer fields in ContentItem
if ci.ContainerArt == "" &&
nowPlaying.Art != nil &&
nowPlaying.Art.ArtImageStatus == "IMAGE_PRESENT" &&
nowPlaying.Art.URL != "" {
ci.ContainerArt = nowPlaying.Art.URL
}
return c.StorePreset(id, &ci)
}
// RemovePreset deletes a preset from the SoundTouch device