Improved exploration

This commit is contained in:
2017-07-01 02:14:14 +02:00
parent 10ef00a810
commit 750302b60e
11 changed files with 114 additions and 67 deletions

46
pages/best/best.go Normal file
View File

@ -0,0 +1,46 @@
package best
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const maxEntries = 7
// Get search page.
func Get(ctx *aero.Context) string {
overall, err := arn.GetListOfAnimeCached("best anime overall")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching popular anime", err)
}
story, err := arn.GetListOfAnimeCached("best anime story")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching popular anime", err)
}
visuals, err := arn.GetListOfAnimeCached("best anime visuals")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching popular anime", err)
}
soundtrack, err := arn.GetListOfAnimeCached("best anime soundtrack")
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching popular anime", err)
}
airing, err := arn.GetAiringAnimeCached()
if err != nil {
return ctx.Error(500, "Couldn't fetch airing anime", err)
}
return ctx.HTML(components.BestAnime(overall[:maxEntries], story[:maxEntries], visuals[:maxEntries], soundtrack[:maxEntries], airing[:maxEntries]))
}

15
pages/best/best.pixy Normal file
View File

@ -0,0 +1,15 @@
component BestAnime(overall []*arn.Anime, story []*arn.Anime, visuals []*arn.Anime, soundtrack []*arn.Anime, airing []*arn.Anime)
h2 Currently Airing
AnimeGrid(airing)
h2 Best Overall
AnimeGrid(overall)
h2 Best Story
AnimeGrid(story)
h2 Best Visuals
AnimeGrid(visuals)
h2 Best Soundtrack
AnimeGrid(soundtrack)