return album genres as a list of objects as per opensubsonic
https://github.com/opensubsonic/open-subsonic-api/pull/51
This commit is contained in:
@@ -44,7 +44,7 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
|
||||
ret.Genre = a.Genres[0].Name
|
||||
}
|
||||
for _, g := range a.Genres {
|
||||
ret.Genres = append(ret.Genres, g.Name)
|
||||
ret.Genres = append(ret.Genres, &GenreRef{Name: g.Name})
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -116,6 +116,10 @@ type ArtistRef struct {
|
||||
Name string `xml:"name,attr" json:"name"`
|
||||
}
|
||||
|
||||
type GenreRef struct {
|
||||
Name string `xml:"name,attr" json:"name"`
|
||||
}
|
||||
|
||||
type Album struct {
|
||||
// common
|
||||
ID *specid.ID `xml:"id,attr,omitempty" json:"id"`
|
||||
@@ -134,7 +138,7 @@ type Album struct {
|
||||
TrackCount int `xml:"songCount,attr" json:"songCount"`
|
||||
Duration int `xml:"duration,attr" json:"duration"`
|
||||
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
||||
Genres []string `xml:"genres,omitempty" json:"genres,omitempty"`
|
||||
Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"`
|
||||
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
||||
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
|
||||
// star / rating
|
||||
|
||||
Reference in New Issue
Block a user