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...")
|
2018-03-28 22:26:19 +00:00
|
|
|
|
|
|
|
defer color.Green("Finished.")
|
2017-11-01 19:12:38 +00:00
|
|
|
defer arn.Node.Close()
|
2017-07-13 06:23:20 +00:00
|
|
|
|
|
|
|
rateLimiter := time.NewTicker(500 * time.Millisecond)
|
|
|
|
|
2017-11-11 11:30:25 +00:00
|
|
|
for anime := range arn.StreamAnime() {
|
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
|
|
|
}
|