dont ommit empty json lists
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package ctrlsubsonic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"sort"
|
||||
@@ -130,6 +131,7 @@ func (c *Controller) ServeGetPlaylists(r *http.Request) *spec.Response {
|
||||
sub.Playlists = &spec.Playlists{
|
||||
List: make([]*spec.Playlist, len(playlists)),
|
||||
}
|
||||
fmt.Println("aaaa")
|
||||
for i, playlist := range playlists {
|
||||
sub.Playlists.List[i] = spec.NewPlaylist(playlist)
|
||||
sub.Playlists.List[i].Owner = user.Name
|
||||
|
||||
@@ -12,5 +12,6 @@ import (
|
||||
func (c *Controller) ServeGetGenres(r *http.Request) *spec.Response {
|
||||
sub := spec.NewResponse()
|
||||
sub.Genres = &spec.Genres{}
|
||||
sub.Genres.List = []*spec.Genre{}
|
||||
return sub
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func NewError(code int, message string, a ...interface{}) *Response {
|
||||
}
|
||||
|
||||
type Albums struct {
|
||||
List []*Album `xml:"album" json:"album,omitempty"`
|
||||
List []*Album `xml:"album" json:"album"`
|
||||
}
|
||||
|
||||
type Album struct {
|
||||
@@ -134,7 +134,7 @@ type TrackChild struct {
|
||||
}
|
||||
|
||||
type Artists struct {
|
||||
List []*Index `xml:"index,omitempty" json:"index,omitempty"`
|
||||
List []*Index `xml:"index,omitempty" json:"index"`
|
||||
}
|
||||
|
||||
type Artist struct {
|
||||
@@ -212,7 +212,7 @@ type User struct {
|
||||
}
|
||||
|
||||
type Playlists struct {
|
||||
List []*Playlist `xml:"playlist" json:"playlist,omitempty"`
|
||||
List []*Playlist `xml:"playlist" json:"playlist"`
|
||||
}
|
||||
|
||||
type Playlist struct {
|
||||
@@ -243,15 +243,15 @@ type ArtistInfo struct {
|
||||
SimilarArtist []*SimilarArtist `xml:"similarArtist,omitempty" json:"similarArtist,omitempty"`
|
||||
}
|
||||
|
||||
type Genres struct {
|
||||
List []*Genre `xml:"genre" json:"genre"`
|
||||
}
|
||||
|
||||
type Genre struct {
|
||||
SongCount string `xml:"songCount,attr"`
|
||||
AlbumCount string `xml:"albumCount,attr"`
|
||||
}
|
||||
|
||||
type Genres struct {
|
||||
Genre []*Genres `xml:"genre" json:"genre"`
|
||||
}
|
||||
|
||||
type PlayQueue struct {
|
||||
Current int `xml:"current,attr,omitempty" json:"current,omitempty"`
|
||||
Position int `xml:"position,attr,omitempty" json:"position,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user