Added filters to editor lists

This commit is contained in:
2018-03-07 22:06:02 +01:00
parent 0c3ab006e7
commit af6bc391af
5 changed files with 46 additions and 4 deletions

View File

@ -12,7 +12,18 @@ const maxAniListEntries = 70
// AniList ...
func AniList(ctx *aero.Context) string {
year, _ := ctx.GetInt("year")
animeType := ctx.Get("type")
missing := arn.FilterAnime(func(anime *arn.Anime) bool {
if year != 0 && year != anime.StartDateTime().Year() {
return false
}
if animeType != "" && anime.Type != animeType {
return false
}
return anime.GetMapping("anilist/anime") == ""
})
@ -40,6 +51,7 @@ func AniList(ctx *aero.Context) string {
"Anime without Anilist links",
missing,
count,
"/editor/anilist",
func(anime *arn.Anime) string {
return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical
},