33 lines
559 B
Go
Raw Normal View History

2017-07-13 05:53:36 +00:00
package main
import (
2017-07-13 06:23:20 +00:00
"fmt"
"time"
2017-07-13 05:53:36 +00:00
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
2017-07-13 06:23:20 +00:00
color.Yellow("Refreshing anime characters...")
2017-11-01 19:12:38 +00:00
defer arn.Node.Close()
2017-07-13 06:23:20 +00:00
2017-07-13 07:20:12 +00:00
allAnime, _ := arn.AllAnime()
2017-07-13 06:23:20 +00:00
rateLimiter := time.NewTicker(500 * time.Millisecond)
2017-07-13 07:20:12 +00:00
for _, anime := range allAnime {
2017-07-13 06:23:20 +00:00
<-rateLimiter.C
chars, err := anime.RefreshAnimeCharacters()
if err != nil {
color.Red(err.Error())
continue
}
fmt.Printf("%s %s (%d characters)\n", anime.ID, anime.Title.Canonical, len(chars.Items))
}
2017-07-13 05:53:36 +00:00
color.Green("Finished.")
}