2018-03-22 19:15:21 +00:00
|
|
|
package filteranime
|
2017-10-02 13:33:39 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
2017-10-06 20:07:12 +00:00
|
|
|
const maxShoboiEntries = 70
|
|
|
|
|
2017-10-02 13:33:39 +00:00
|
|
|
// Shoboi ...
|
|
|
|
func Shoboi(ctx *aero.Context) string {
|
2018-03-07 21:06:02 +00:00
|
|
|
year, _ := ctx.GetInt("year")
|
|
|
|
animeType := ctx.Get("type")
|
|
|
|
|
2017-10-27 07:11:56 +00:00
|
|
|
missing := arn.FilterAnime(func(anime *arn.Anime) bool {
|
2018-03-07 21:06:02 +00:00
|
|
|
if year != 0 && year != anime.StartDateTime().Year() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if animeType != "" && anime.Type != animeType {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-10-02 13:33:39 +00:00
|
|
|
return anime.GetMapping("shoboi/anime") == ""
|
|
|
|
})
|
|
|
|
|
2018-03-22 19:15:21 +00:00
|
|
|
arn.SortAnimeByQuality(missing)
|
2017-10-02 13:33:39 +00:00
|
|
|
|
2018-03-07 20:25:24 +00:00
|
|
|
count := len(missing)
|
|
|
|
|
|
|
|
if count > maxShoboiEntries {
|
2017-10-06 20:07:12 +00:00
|
|
|
missing = missing[:maxShoboiEntries]
|
|
|
|
}
|
|
|
|
|
2018-03-07 20:25:24 +00:00
|
|
|
return ctx.HTML(components.AnimeEditorListFull(
|
2018-03-22 19:15:21 +00:00
|
|
|
"Anime without Shoboi mappings",
|
2018-03-07 20:25:24 +00:00
|
|
|
missing,
|
|
|
|
count,
|
2018-03-20 15:53:23 +00:00
|
|
|
ctx.URI(),
|
2018-03-07 20:25:24 +00:00
|
|
|
func(anime *arn.Anime) string {
|
|
|
|
return "http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese
|
|
|
|
},
|
|
|
|
))
|
2017-10-02 13:33:39 +00:00
|
|
|
}
|