🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add coverArt to Subsonic playlist response
Deluan950cc28e6760
diff --git a/server/subsonic/playlists.go b/server/subsonic/playlists.goindex d78944fd1..58ce67872 100644--- a/server/subsonic/playlists.go+++ b/server/subsonic/playlists.go@@ -171,5 +171,6 @@ func (api *Router) buildPlaylist(p model.Playlist) *responses.Playlist {pls.Public = p.Publicpls.Created = p.CreatedAtpls.Changed = p.UpdatedAt+ pls.CoverArt = p.CoverArtID().String()return pls}diff --git a/server/subsonic/responses/.snapshots/Responses Playlists with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Playlists with data should match .JSONindex ae5756c4f..ca11eb3bf 100644--- a/server/subsonic/responses/.snapshots/Responses Playlists with data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses Playlists with data should match .JSON@@ -1 +1 @@-{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","playlists":{"playlist":[{"id":"111","name":"aaa","comment":"comment","songCount":2,"duration":120,"public":true,"owner":"admin","created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"},{"id":"222","name":"bbb","songCount":0,"duration":0,"public":false,"created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"}]}}+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","playlists":{"playlist":[{"id":"111","name":"aaa","comment":"comment","songCount":2,"duration":120,"public":true,"owner":"admin","created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","coverArt":"pl-123123123123"},{"id":"222","name":"bbb","songCount":0,"duration":0,"public":false,"created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"}]}}diff --git a/server/subsonic/responses/.snapshots/Responses Playlists with data should match .XML b/server/subsonic/responses/.snapshots/Responses Playlists with data should match .XMLindex 9e9454a75..c97edbf09 100644--- a/server/subsonic/responses/.snapshots/Responses Playlists with data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses Playlists with data should match .XML@@ -1 +1 @@-<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><playlists><playlist id="111" name="aaa" comment="comment" songCount="2" duration="120" public="true" owner="admin" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z"></playlist><playlist id="222" name="bbb" songCount="0" duration="0" public="false" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z"></playlist></playlists></subsonic-response>+<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><playlists><playlist id="111" name="aaa" comment="comment" songCount="2" duration="120" public="true" owner="admin" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z" coverArt="pl-123123123123"></playlist><playlist id="222" name="bbb" songCount="0" duration="0" public="false" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z"></playlist></playlists></subsonic-response>diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex 795e1290f..085925a65 100644--- a/server/subsonic/responses/responses.go+++ b/server/subsonic/responses/responses.go@@ -213,11 +213,11 @@ type Playlist struct {Owner string `xml:"owner,attr,omitempty" json:"owner,omitempty"`Created time.Time `xml:"created,attr" json:"created"`Changed time.Time `xml:"changed,attr" json:"changed"`+ CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`/*<xs:sequence><xs:element name="allowedUser" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!--Added in 1.8.0--></xs:sequence>- <xs:attribute name="coverArt" type="xs:string" use="optional"/> <!--Added in 1.11.0-->*/}diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.goindex 4a2715f23..6c2752490 100644--- a/server/subsonic/responses/responses_test.go+++ b/server/subsonic/responses/responses_test.go@@ -286,6 +286,7 @@ var _ = Describe("Responses", func() {Duration: 120,Public: true,Owner: "admin",+ CoverArt: "pl-123123123123",Created: timestamp,Changed: timestamp,}