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 {
|
2016-11-20 10:26:11 +00:00
|
|
|
// Skip this genre because it doesn't get processed in the background jobs
|
|
|
|
if genreName == "Hentai" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2016-11-19 19:53:33 +00:00
|
|
|
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
|
|
|
}
|