32 lines
552 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"
2019-04-23 05:45:17 +00:00
"github.com/akyoto/color"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2017-07-13 05:53:36 +00:00
)
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
}