Fix Bookmarks Subsonic support (#1099)

JSON responses were incorrect
This commit is contained in:
Deluan 2021-05-07 09:47:13 -04:00
parent 47f4e0a4de
commit 3e8d3e78c2
4 changed files with 4 additions and 4 deletions

View File

@ -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,

View File

@ -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"}]}}

View File

@ -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"`

View File

@ -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() {