From 49228f245c5a6922dcdc2c60dbc4130ffb4c0a09 Mon Sep 17 00:00:00 2001 From: sentriz Date: Sun, 9 Feb 2020 15:10:55 +0000 Subject: [PATCH] return more counts --- server/ctrlsubsonic/handlers_by_tags.go | 1 + server/ctrlsubsonic/spec/spec.go | 32 ++++++++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/server/ctrlsubsonic/handlers_by_tags.go b/server/ctrlsubsonic/handlers_by_tags.go index eeaa1ff..ca06f6b 100644 --- a/server/ctrlsubsonic/handlers_by_tags.go +++ b/server/ctrlsubsonic/handlers_by_tags.go @@ -66,6 +66,7 @@ func (c *Controller) ServeGetArtist(r *http.Request) *spec.Response { for i, album := range artist.Albums { sub.Artist.Albums[i] = spec.NewAlbumByTags(album, artist) } + sub.Artist.AlbumCount = len(artist.Albums) return sub } diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index bf8aa36..77e834b 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -94,11 +94,11 @@ type Album struct { ParentID int `xml:"parent,attr,omitempty" json:"parent,omitempty"` IsDir bool `xml:"isDir,attr,omitempty" json:"isDir,omitempty"` // browsing by tags (getAlbumList2) - Name string `xml:"name,attr,omitempty" json:"name,omitempty"` - TrackCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"` - Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` - Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` - Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"` + Name string `xml:"name,attr,omitempty" json:"name,omitempty"` + TrackCount int `xml:"songCount,attr" json:"songCount"` + Duration int `xml:"duration,attr" json:"duration"` + Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` + Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"` } type RandomTracks struct { @@ -134,11 +134,11 @@ type Artists struct { } type Artist struct { - ID int `xml:"id,attr,omitempty" json:"id"` - Name string `xml:"name,attr,omitempty" json:"name"` - CoverID int `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` - AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"` - Albums []*Album `xml:"album,omitempty" json:"album,omitempty"` + ID int `xml:"id,attr,omitempty" json:"id"` + Name string `xml:"name,attr,omitempty" json:"name"` + CoverID int `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` + AlbumCount int `xml:"albumCount,attr" json:"albumCount"` + Albums []*Album `xml:"album,omitempty" json:"album,omitempty"` } type Indexes struct { @@ -212,12 +212,12 @@ type Playlists struct { } type Playlist struct { - ID int `xml:"id,attr" json:"id,omitempty"` - Name string `xml:"name,attr" json:"name,omitempty"` - Comment string `xml:"comment,attr" json:"comment,omitempty"` - Owner string `xml:"owner,attr" json:"owner,omitempty"` - SongCount string `xml:"songCount,attr" json:"songCount,omitempty"` - Created string `xml:"created,attr" json:"created,omitempty"` + ID int `xml:"id,attr" json:"id"` + Name string `xml:"name,attr" json:"name"` + Comment string `xml:"comment,attr" json:"comment"` + Owner string `xml:"owner,attr" json:"owner"` + SongCount int `xml:"songCount,attr" json:"songCount"` + Created string `xml:"created,attr" json:"created"` Duration string `xml:"duration,attr" json:"duration,omitempty"` Public bool `xml:"public,attr" json:"public,omitempty"` List []*TrackChild `xml:"entry" json:"entry,omitempty"`