32 lines
540 B
Go
Raw Normal View History

2017-07-13 07:53:36 +02:00
package main
import (
2017-07-13 08:23:20 +02:00
"fmt"
"time"
2017-07-13 07:53:36 +02:00
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
2017-07-13 08:23:20 +02:00
color.Yellow("Refreshing anime characters...")
2018-03-29 00:26:19 +02:00
defer color.Green("Finished.")
2017-11-01 20:12:38 +01:00
defer arn.Node.Close()
2017-07-13 08:23:20 +02:00
rateLimiter := time.NewTicker(500 * time.Millisecond)
2017-11-11 12:30:25 +01:00
for anime := range arn.StreamAnime() {
2017-07-13 08:23:20 +02: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 07:53:36 +02:00
}