feat(subsonic): expose all album genres in a list of subsonic api

expose album genres from getArtist
This commit is contained in:
sentriz
2023-09-11 18:10:30 +01:00
parent d6b35f8c79
commit 749233db4e
8 changed files with 36 additions and 1 deletions

View File

@@ -15,7 +15,6 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
Name: a.TagTitle,
Year: a.TagYear,
TrackCount: a.ChildCount,
Genre: strings.Join(a.GenreStrings(), ", "),
Duration: a.Duration,
AverageRating: formatRating(a.AverageRating),
}
@@ -41,6 +40,12 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
Name: a.Name,
})
}
if len(a.Genres) > 0 {
ret.Genre = a.Genres[0].Name
}
for _, g := range a.Genres {
ret.Genres = append(ret.Genres, g.Name)
}
return ret
}

View File

@@ -134,6 +134,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"`
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
// star / rating