diff --git a/server/ctrlsubsonic/handlers_common.go b/server/ctrlsubsonic/handlers_common.go index 799d5eb..5c946c0 100644 --- a/server/ctrlsubsonic/handlers_common.go +++ b/server/ctrlsubsonic/handlers_common.go @@ -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 diff --git a/server/ctrlsubsonic/handlers_unimplemented.go b/server/ctrlsubsonic/handlers_unimplemented.go index 287b90f..0767ede 100644 --- a/server/ctrlsubsonic/handlers_unimplemented.go +++ b/server/ctrlsubsonic/handlers_unimplemented.go @@ -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 } diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index 7353067..fe87d0e 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -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"`