2016-11-19 14:54:31 +00:00
|
|
|
package genres
|
|
|
|
|
|
|
|
import (
|
2016-11-19 19:53:33 +00:00
|
|
|
"fmt"
|
|
|
|
|
2016-11-19 14:54:31 +00:00
|
|
|
"github.com/aerogo/aero"
|
2016-11-19 19:53:33 +00:00
|
|
|
"github.com/animenotifier/arn"
|
2016-11-19 14:54:31 +00:00
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Get ...
|
|
|
|
func Get(ctx *aero.Context) string {
|
2016-11-19 19:53:33 +00:00
|
|
|
var genres []*arn.Genre
|
|
|
|
|
|
|
|
for _, genreName := range arn.Genres {
|
|
|
|
genre, err := arn.GetGenre(arn.GetGenreIDByName(genreName))
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
genre.Name = genreName
|
|
|
|
genres = append(genres, genre)
|
|
|
|
} else {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.HTML(components.Genres(genres))
|
2016-11-19 14:54:31 +00:00
|
|
|
}
|