43 lines
673 B
Go
Raw Normal View History

2018-04-06 05:48:52 +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-06 05:48:52 +00:00
)
func main() {
color.Yellow("Fixing anime IDs in anime lists")
defer color.Green("Finished")
defer arn.Node.Close()
finder := arn.NewAnimeFinder("kitsu/anime")
for animeList := range arn.StreamAnimeLists() {
modified := false
for _, item := range animeList.Items {
anime := item.Anime()
if anime != nil {
continue
}
anime = finder.GetAnime(item.AnimeID)
if anime != nil {
item.AnimeID = anime.ID
modified = true
}
fmt.Println(item.AnimeID, anime, animeList.User().Nick)
}
if modified {
animeList.Save()
}
}
}