Skip to content

🎧 Your Personal Streaming Service

Fix Bookmarks Subsonic support (#1099)

Deluan3e8d3e78c236
diff --git a/server/subsonic/bookmarks.go b/server/subsonic/bookmarks.go
index 0b2dac933..c6ed7c2e5 100644
--- a/server/subsonic/bookmarks.go
+++ b/server/subsonic/bookmarks.go
@@ -31,7 +31,7 @@ func (c *BookmarksController) GetBookmarks(w http.ResponseWriter, r *http.Reques
response.Bookmarks = &responses.Bookmarks{}
for _, bmk := range bmks {
b := responses.Bookmark{
- Entry: []responses.Child{childFromMediaFile(r.Context(), bmk.Item)},
+ Entry: childFromMediaFile(r.Context(), bmk.Item),
Position: bmk.Position,
Username: user.UserName,
Comment: bmk.Comment,
diff --git a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Bookmarks with data should match .JSON b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Bookmarks with data should match .JSON
index ae9fc6fa2..42034480f 100644
--- a/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Bookmarks with data should match .JSON
+++ b/server/subsonic/responses/.snapshots/responses-snapshotMatcher-Match-Responses Bookmarks with data should match .JSON
@@ -1 +1 @@
-{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","bookmarks":{"bookmark":[{"entry":[{"id":"1","isDir":false,"title":"title","isVideo":false}],"position":123,"username":"user2","comment":"a comment","created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"}]}}
+{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","bookmarks":{"bookmark":[{"entry":{"id":"1","isDir":false,"title":"title","isVideo":false},"position":123,"username":"user2","comment":"a comment","created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"}]}}
diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.go
index 335821397..572761397 100644
--- a/server/subsonic/responses/responses.go
+++ b/server/subsonic/responses/responses.go
@@ -328,7 +328,7 @@ type PlayQueue struct {
}
type Bookmark struct {
- Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`
+ Entry Child `xml:"entry,omitempty" json:"entry,omitempty"`
Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"`
Username string `xml:"username,attr" json:"username"`
Comment string `xml:"comment,attr" json:"comment"`
diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.go
index b5c28c971..cfcfe8ff8 100644
--- a/server/subsonic/responses/responses_test.go
+++ b/server/subsonic/responses/responses_test.go
@@ -516,7 +516,7 @@ var _ = Describe("Responses", func() {
Created: time.Time{},
Changed: time.Time{},
}
- bmk.Entry = []Child{{Id: "1", Title: "title", IsDir: false}}
+ bmk.Entry = Child{Id: "1", Title: "title", IsDir: false}
response.Bookmarks.Bookmark = []Bookmark{bmk}
})
It("should match .XML", func() {