Add MAL connections

This commit is contained in:
Eduard Urbach 2017-07-08 01:50:15 +02:00
parent f90522203d
commit 2edfd91338

View File

@ -0,0 +1,35 @@
package main
import (
"strconv"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
for anime := range arn.MustStreamAnime() {
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
arn.PanicOnError(arn.DB.Set("MyAnimeListToAnime", malID, &arn.MyAnimeListToAnime{
AnimeID: anime.ID,
ServiceID: malID,
Edited: arn.DateTimeUTC(),
EditedBy: "",
}))
}
}