Added anime grid for genres (up to 100 for now)

This commit is contained in:
2017-11-30 01:47:12 +01:00
parent 1c2cd2cee7
commit 91b6ae7efd
7 changed files with 46 additions and 86 deletions

View File

@ -1,8 +1,6 @@
package genres
import (
"fmt"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
@ -10,22 +8,15 @@ import (
// Get ...
func Get(ctx *aero.Context) string {
var genres []*arn.Genre
var genres []string
for _, genreName := range arn.Genres {
for _, genre := range arn.Genres {
// Skip this genre because it doesn't get processed in the background jobs
if genreName == "Hentai" {
continue
}
genre, err := arn.GetGenre(arn.GetGenreIDByName(genreName))
if err == nil {
genre.Name = genreName
genres = append(genres, genre)
} else {
fmt.Println(err)
}
genres = append(genres, genre)
}
return ctx.HTML(components.Genres(genres))