🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add PlayQueue Subsonic response
Deluan16c38eb34498
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue with data should match .JSONnew file mode 100644index 000000000..3821ebd68--- /dev/null+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue with data should match .JSON@@ -0,0 +1 @@+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","playQueue":{"entry":[{"id":"1","isDir":false,"title":"title","isVideo":false}],"current":"111","position":243,"username":"user1","changed":"0001-01-01T00:00:00Z","changedBy":"a_client"}}diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue with data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue with data should match .XMLnew file mode 100644index 000000000..9e0f82aef--- /dev/null+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue with data should match .XML@@ -0,0 +1 @@+<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><playQueue current="111" position="243" username="user1" changed="0001-01-01T00:00:00Z" changedBy="a_client"><entry id="1" isDir="false" title="title" isVideo="false"></entry></playQueue></subsonic-response>diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue without data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue without data should match .JSONnew file mode 100644index 000000000..0386aaa90--- /dev/null+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue without data should match .JSON@@ -0,0 +1 @@+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","playQueue":{"username":"","changedBy":""}}diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue without data should match .XML b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue without data should match .XMLnew file mode 100644index 000000000..42ccb087f--- /dev/null+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses PlayQueue without data should match .XML@@ -0,0 +1 @@+<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><playQueue username="" changedBy=""></playQueue></subsonic-response>diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex a44ea61ee..eb529ea14 100644--- a/server/subsonic/responses/responses.go+++ b/server/subsonic/responses/responses.go@@ -36,8 +36,10 @@ type Subsonic struct {ArtistWithAlbumsID3 *ArtistWithAlbumsID3 `xml:"artist,omitempty" json:"artist,omitempty"`AlbumWithSongsID3 *AlbumWithSongsID3 `xml:"album,omitempty" json:"album,omitempty"`- ArtistInfo *ArtistInfo `xml:"artistInfo,omitempty" json:"artistInfo,omitempty"`- ArtistInfo2 *ArtistInfo2 `xml:"artistInfo2,omitempty" json:"artistInfo2,omitempty"`+ ArtistInfo *ArtistInfo `xml:"artistInfo,omitempty" json:"artistInfo,omitempty"`+ ArtistInfo2 *ArtistInfo2 `xml:"artistInfo2,omitempty" json:"artistInfo2,omitempty"`++ PlayQueue *PlayQueue `xml:"playQueue,omitempty" json:"playQueue,omitempty"`}type JsonWrapper struct {@@ -293,3 +295,12 @@ type ArtistInfo2 struct {ArtistInfoBaseSimilarArtist []ArtistID3 `xml:"similarArtist,omitempty" json:"similarArtist,omitempty"`}++type PlayQueue struct {+ Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`+ Current string `xml:"current,attr,omitempty" json:"current,omitempty"`+ Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"`+ Username string `xml:"username,attr" json:"username"`+ Changed *time.Time `xml:"changed,attr,omitempty" json:"changed,omitempty"`+ ChangedBy string `xml:"changedBy,attr" json:"changedBy"`+}diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.goindex 229675f71..fc07331d1 100644--- a/server/subsonic/responses/responses_test.go+++ b/server/subsonic/responses/responses_test.go@@ -331,4 +331,39 @@ var _ = Describe("Responses", func() {})})++ Describe("PlayQueue", func() {+ BeforeEach(func() {+ response.PlayQueue = &PlayQueue{}+ })++ Context("without data", func() {+ It("should match .XML", func() {+ Expect(xml.Marshal(response)).To(MatchSnapshot())+ })+ It("should match .JSON", func() {+ Expect(json.Marshal(response)).To(MatchSnapshot())+ })+ })++ Context("with data", func() {+ BeforeEach(func() {+ response.PlayQueue.Username = "user1"+ response.PlayQueue.Current = "111"+ response.PlayQueue.Position = 243+ response.PlayQueue.Changed = &time.Time{}+ response.PlayQueue.ChangedBy = "a_client"+ child := make([]Child, 1)+ child[0] = Child{Id: "1", Title: "title", IsDir: false}+ response.PlayQueue.Entry = child++ })+ It("should match .XML", func() {+ Expect(xml.Marshal(response)).To(MatchSnapshot())+ })+ It("should match .JSON", func() {+ Expect(json.Marshal(response)).To(MatchSnapshot())+ })+ })+ })})