mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-05 01:43:11 +03:00
Make fields songCount
, duration
, created
and changed
mandatory in playlists responses (fixes #164)
This commit is contained in:
parent
9fb4f5ef52
commit
e476a5f6f1
@ -36,8 +36,8 @@ func (c *PlaylistsController) GetPlaylists(w http.ResponseWriter, r *http.Reques
|
|||||||
playlists[i].Duration = int(p.Duration)
|
playlists[i].Duration = int(p.Duration)
|
||||||
playlists[i].Owner = p.Owner
|
playlists[i].Owner = p.Owner
|
||||||
playlists[i].Public = p.Public
|
playlists[i].Public = p.Public
|
||||||
playlists[i].Created = &p.CreatedAt
|
playlists[i].Created = p.CreatedAt
|
||||||
playlists[i].Changed = &p.UpdatedAt
|
playlists[i].Changed = p.UpdatedAt
|
||||||
}
|
}
|
||||||
response := NewResponse()
|
response := NewResponse()
|
||||||
response.Playlists = &responses.Playlists{Playlist: playlists}
|
response.Playlists = &responses.Playlists{Playlist: playlists}
|
||||||
@ -144,7 +144,7 @@ func (c *PlaylistsController) buildPlaylist(d *engine.PlaylistInfo) *responses.P
|
|||||||
pls.Owner = d.Owner
|
pls.Owner = d.Owner
|
||||||
pls.Duration = d.Duration
|
pls.Duration = d.Duration
|
||||||
pls.Public = d.Public
|
pls.Public = d.Public
|
||||||
pls.Created = &d.Created
|
pls.Created = d.Created
|
||||||
pls.Changed = &d.Changed
|
pls.Changed = d.Changed
|
||||||
return pls
|
return pls
|
||||||
}
|
}
|
||||||
|
@ -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"}]}}
|
{"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,"created":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z"}]}}
|
||||||
|
@ -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"></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"></playlist><playlist id="222" name="bbb" songCount="0" duration="0" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z"></playlist></playlists></subsonic-response>
|
||||||
|
@ -188,15 +188,15 @@ type AlbumList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Playlist struct {
|
type Playlist struct {
|
||||||
Id string `xml:"id,attr" json:"id"`
|
Id string `xml:"id,attr" json:"id"`
|
||||||
Name string `xml:"name,attr" json:"name"`
|
Name string `xml:"name,attr" json:"name"`
|
||||||
Comment string `xml:"comment,attr,omitempty" json:"comment,omitempty"`
|
Comment string `xml:"comment,attr,omitempty" json:"comment,omitempty"`
|
||||||
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
|
SongCount int `xml:"songCount,attr" json:"songCount"`
|
||||||
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
Duration int `xml:"duration,attr" json:"duration"`
|
||||||
Public bool `xml:"public,attr,omitempty" json:"public,omitempty"`
|
Public bool `xml:"public,attr,omitempty" json:"public,omitempty"`
|
||||||
Owner string `xml:"owner,attr,omitempty" json:"owner,omitempty"`
|
Owner string `xml:"owner,attr,omitempty" json:"owner,omitempty"`
|
||||||
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
Created time.Time `xml:"created,attr" json:"created"`
|
||||||
Changed *time.Time `xml:"changed,attr,omitempty" json:"changed,omitempty"`
|
Changed time.Time `xml:"changed,attr" json:"changed"`
|
||||||
/*
|
/*
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="allowedUser" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!--Added in 1.8.0-->
|
<xs:element name="allowedUser" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!--Added in 1.8.0-->
|
||||||
|
@ -246,8 +246,8 @@ var _ = Describe("Responses", func() {
|
|||||||
Duration: 120,
|
Duration: 120,
|
||||||
Public: true,
|
Public: true,
|
||||||
Owner: "admin",
|
Owner: "admin",
|
||||||
Created: ×tamp,
|
Created: timestamp,
|
||||||
Changed: ×tamp,
|
Changed: timestamp,
|
||||||
}
|
}
|
||||||
pls[1] = Playlist{Id: "222", Name: "bbb"}
|
pls[1] = Playlist{Id: "222", Name: "bbb"}
|
||||||
response.Playlists.Playlist = pls
|
response.Playlists.Playlist = pls
|
||||||
|
Loading…
x
Reference in New Issue
Block a user