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