Improved refresh

This commit is contained in:
Eduard Urbach 2017-07-02 14:08:25 +02:00
parent f82e1ea961
commit 771c16066a

View File

@ -1,6 +1,10 @@
package main package main
import ( import (
"fmt"
"strconv"
"strings"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/fatih/color" "github.com/fatih/color"
) )
@ -9,10 +13,18 @@ func main() {
color.Yellow("Refreshing episode information for each anime.") color.Yellow("Refreshing episode information for each anime.")
for anime := range arn.MustStreamAnime() { for anime := range arn.MustStreamAnime() {
episodeCount := len(anime.Episodes)
err := anime.RefreshEpisodes() err := anime.RefreshEpisodes()
if err != nil { if err != nil {
if strings.Contains(err.Error(), "missing a Shoboi ID") {
continue
}
color.Red(err.Error()) color.Red(err.Error())
} else {
fmt.Println(anime.ID, "|", anime.Title.Canonical, "+"+strconv.Itoa(len(anime.Episodes)-episodeCount))
} }
} }