41 lines
824 B
Go
41 lines
824 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/animenotifier/anilist"
|
|
"github.com/animenotifier/arn"
|
|
"github.com/fatih/color"
|
|
)
|
|
|
|
var userName = "Akyoto"
|
|
var allAnime []*arn.Anime
|
|
|
|
func init() {
|
|
allAnime = arn.AllAnime()
|
|
}
|
|
|
|
func main() {
|
|
user, _ := arn.GetUserByNick(userName)
|
|
animeList, err := anilist.GetAnimeList(user.Accounts.AniList.Nick)
|
|
arn.PanicOnError(err)
|
|
|
|
importList(animeList.Lists.Watching)
|
|
importList(animeList.Lists.Completed)
|
|
}
|
|
|
|
func importList(animeListItems []*anilist.AnimeListItem) {
|
|
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))
|
|
}
|