🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Fix getOpenSubsonicExtensions endpoint
Deluanf543e7accc36
diff --git a/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions with data should match .JSON b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions with data should match .JSONnew file mode 100644index 000000000..5e8b33ae3--- /dev/null+++ b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions with data should match .JSON@@ -0,0 +1,16 @@+{+ "status": "ok",+ "version": "1.8.0",+ "type": "navidrome",+ "serverVersion": "v0.0.0",+ "openSubsonic": true,+ "openSubsonicExtensions": [+ {+ "name": "template",+ "versions": [+ 1,+ 2+ ]+ }+ ]+}diff --git a/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions with data should match .XML b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions with data should match .XMLnew file mode 100644index 000000000..587eda70d--- /dev/null+++ b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions with data should match .XML@@ -0,0 +1,6 @@+<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">+ <openSubsonicExtensions name="template">+ <versions>1</versions>+ <versions>2</versions>+ </openSubsonicExtensions>+</subsonic-response>diff --git a/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions without data should match .JSON b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions without data should match .JSONnew file mode 100644index 000000000..143bd1f80--- /dev/null+++ b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions without data should match .JSON@@ -0,0 +1,8 @@+{+ "status": "ok",+ "version": "1.8.0",+ "type": "navidrome",+ "serverVersion": "v0.0.0",+ "openSubsonic": true,+ "openSubsonicExtensions": []+}diff --git a/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions without data should match .XML b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions without data should match .XMLnew file mode 100644index 000000000..651d6df0d--- /dev/null+++ b/server/subsonic/responses/.snapshots/Responses OpenSubsonicExtensions 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" openSubsonic="true"></subsonic-response>diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex 87f9fa508..07c3b07f0 100644--- a/server/subsonic/responses/responses.go+++ b/server/subsonic/responses/responses.go@@ -424,13 +424,18 @@ type JukeboxPlaylist struct {JukeboxStatusEntry []Child `xml:"entry,omitempty" json:"entry,omitempty"`}-type OpenSubsonicExtensions struct{}+type OpenSubsonicExtension struct {+ Name string `xml:"name,attr" json:"name"`+ Versions []int32 `xml:"versions" json:"versions"`+}++type OpenSubsonicExtensions []OpenSubsonicExtension-// OpenSubsonic response type for multi-valued genres listtype ItemGenre struct {Name string `xml:"name,attr" json:"name"`}+// ItemGenres holds a list of genres (OpenSubsonic). If it is null, it must be marshalled as an empty array.type ItemGenres []ItemGenrefunc (i ItemGenres) MarshalJSON() ([]byte, error) {diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.goindex 6fc95270c..14cc2d26c 100644--- a/server/subsonic/responses/responses_test.go+++ b/server/subsonic/responses/responses_test.go@@ -725,6 +725,36 @@ var _ = Describe("Responses", func() {})})+ Describe("OpenSubsonicExtensions", func() {+ BeforeEach(func() {+ response.OpenSubsonic = true+ response.OpenSubsonicExtensions = &OpenSubsonicExtensions{}+ })++ Describe("without data", func() {+ It("should match .XML", func() {+ Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())+ })+ It("should match .JSON", func() {+ Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())+ })+ })++ Describe("with data", func() {+ BeforeEach(func() {+ response.OpenSubsonicExtensions = &OpenSubsonicExtensions{+ OpenSubsonicExtension{Name: "template", Versions: []int32{1, 2}},+ }+ })+ It("should match .XML", func() {+ Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())+ })+ It("should match .JSON", func() {+ Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())+ })+ })+ })+Describe("InternetRadioStations", func() {BeforeEach(func() {response.InternetRadioStations = &InternetRadioStations{}