41 lines
824 B
Go
Raw Normal View History

2017-07-01 23:44:10 +00:00
package main
import (
"fmt"
2017-07-09 13:56:40 +00:00
"github.com/animenotifier/anilist"
2017-07-01 23:44:10 +00:00
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
var userName = "Akyoto"
var allAnime []*arn.Anime
func init() {
2017-11-11 11:30:25 +00:00
allAnime = arn.AllAnime()
2017-07-01 23:44:10 +00:00
}
func main() {
user, _ := arn.GetUserByNick(userName)
2017-07-09 13:56:40 +00:00
animeList, err := anilist.GetAnimeList(user.Accounts.AniList.Nick)
2017-07-01 23:44:10 +00:00
arn.PanicOnError(err)
importList(animeList.Lists.Watching)
importList(animeList.Lists.Completed)
}
2017-07-09 13:56:40 +00:00
func importList(animeListItems []*anilist.AnimeListItem) {
2017-07-01 23:44:10 +00:00
imported := []*arn.Anime{}
for _, item := range animeListItems {
anime := arn.FindAniListAnime(item.Anime, allAnime)
if anime != nil {
fmt.Println(item.Anime.TitleRomaji, "=>", anime.Title.Romaji)
imported = append(imported, anime)
}
}
color.Green("%d / %d", len(imported), len(animeListItems))
}