2018-04-03 20:24:06 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
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"
|
2018-04-03 20:24:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
color.Yellow("Adding Kitsu mappings")
|
|
|
|
|
|
|
|
defer color.Green("Finished.")
|
|
|
|
defer arn.Node.Close()
|
|
|
|
|
2018-04-04 13:21:52 +00:00
|
|
|
finder := arn.NewAnimeFinder("kitsu/anime")
|
2018-04-04 12:51:55 +00:00
|
|
|
|
2018-04-03 20:24:06 +00:00
|
|
|
for mapping := range arn.StreamKitsuMappings() {
|
|
|
|
if mapping.Relationships.Item.Data.Type != "anime" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if mapping.Attributes.ExternalSite != "trakt" && mapping.Attributes.ExternalSite != "anidb" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2018-04-04 13:08:18 +00:00
|
|
|
anime := finder.GetAnime(mapping.Relationships.Item.Data.ID)
|
2018-04-03 20:24:06 +00:00
|
|
|
|
|
|
|
if anime == nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(anime.ID, mapping.Attributes.ExternalSite, mapping.Attributes.ExternalID)
|
|
|
|
|
|
|
|
anime.ImportKitsuMapping(mapping)
|
|
|
|
anime.Save()
|
|
|
|
}
|
|
|
|
}
|