Skip to content

Commit

Permalink
Add coverArt to Subsonic playlist response
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Jan 2, 2023
1 parent 6260927 commit 950cc28
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/subsonic/playlists.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,6 @@ func (api *Router) buildPlaylist(p model.Playlist) *responses.Playlist {
pls.Public = p.Public
pls.Created = p.CreatedAt
pls.Changed = p.UpdatedAt
pls.CoverArt = p.CoverArtID().String()
return pls
}
Original file line number Diff line number Diff line change
@@ -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"}]}}
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion server/subsonic/responses/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -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-->
*/
}

Expand Down
1 change: 1 addition & 0 deletions server/subsonic/responses/responses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ var _ = Describe("Responses", func() {
Duration: 120,
Public: true,
Owner: "admin",
CoverArt: "pl-123123123123",
Created: timestamp,
Changed: timestamp,
}
Expand Down

0 comments on commit 950cc28

Please sign in to comment.