38 lines
666 B
Go
Raw Normal View History

2017-07-07 23:50:15 +00:00
package main
import (
"strconv"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
2017-11-01 19:11:05 +00:00
defer arn.Node.Close()
for anime := range arn.StreamAnime() {
2017-07-07 23:50:15 +00:00
malID := anime.GetMapping("myanimelist/anime")
if malID == "" {
continue
}
// Assure the string represents a number
malNum, _ := strconv.Atoi(malID)
normalizedID := strconv.Itoa(malNum)
if malID != normalizedID {
color.Red("%s does not match %d", malID, normalizedID)
continue
}
// Save
2017-11-01 19:11:05 +00:00
arn.DB.Set("MyAnimeListToAnime", malID, &arn.MyAnimeListToAnime{
2017-07-07 23:50:15 +00:00
AnimeID: anime.ID,
ServiceID: malID,
Edited: arn.DateTimeUTC(),
EditedBy: "",
2017-11-01 19:11:05 +00:00
})
2017-07-07 23:50:15 +00:00
}
}