2017-07-13 05:53:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/kitsu"
|
|
|
|
"github.com/fatih/color"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
color.Yellow("Syncing characters with Kitsu DB")
|
2017-11-01 10:16:31 +00:00
|
|
|
defer arn.Node.Close()
|
2017-07-13 05:53:36 +00:00
|
|
|
|
|
|
|
kitsuCharacters := kitsu.StreamCharacters()
|
|
|
|
|
|
|
|
for kitsuCharacter := range kitsuCharacters {
|
|
|
|
character := &arn.Character{
|
|
|
|
ID: kitsuCharacter.ID,
|
|
|
|
Name: kitsuCharacter.Attributes.Name,
|
|
|
|
Image: kitsu.FixImageURL(kitsuCharacter.Attributes.Image.Original),
|
2017-07-13 06:23:20 +00:00
|
|
|
Description: arn.FixAnimeDescription(kitsuCharacter.Attributes.Description),
|
2017-07-13 05:53:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf("%s %s\n", character.ID, character.Name)
|
|
|
|
|
2017-11-01 10:16:31 +00:00
|
|
|
character.Save()
|
2017-07-13 05:53:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("Finished.")
|
|
|
|
}
|