Airing anime page

This commit is contained in:
2017-06-06 22:08:43 +02:00
parent b305be5ae4
commit 2f0d8c9636
6 changed files with 54 additions and 75 deletions

View File

@ -0,0 +1,39 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Caching airing anime")
animeList, err := arn.GetAiringAnime()
if err != nil {
color.Red("Failed fetching airing anime")
color.Red(err.Error())
return
}
// sort.Slice
// Convert to small anime list
cache := &arn.ListOfIDs{}
for _, anime := range animeList {
cache.IDList = append(cache.IDList, anime.ID)
}
println(len(cache.IDList))
saveErr := arn.SetObject("Cache", "airing anime", cache)
if saveErr != nil {
color.Red("Error saving airing anime")
color.Red(saveErr.Error())
return
}
color.Green("Finished.")
}