Add GetGenre endpoint

This commit is contained in:
Deluan 2020-01-15 17:49:09 -05:00
parent ca2c897340
commit 36d93774bc
22 changed files with 303 additions and 26 deletions

View file

@ -9,6 +9,7 @@ import (
"github.com/cloudsonic/sonic-server/api/responses"
"github.com/cloudsonic/sonic-server/engine"
"github.com/cloudsonic/sonic-server/model"
"github.com/cloudsonic/sonic-server/utils"
)
@ -185,3 +186,11 @@ func ToChild(entry engine.Entry) responses.Child {
child.SongCount = entry.SongCount
return child
}
func ToGenres(genres model.Genres) *responses.Genres {
response := make([]responses.Genre, len(genres))
for i, g := range genres {
response[i] = responses.Genre(g)
}
return &responses.Genres{Genre: response}
}