Added kitsu anime ID mapping

This commit is contained in:
Eduard Urbach 2018-04-04 11:38:16 +02:00
parent a8379ddc8c
commit 2f7dc5b662
3 changed files with 24 additions and 52 deletions

View File

@ -127,10 +127,6 @@ component AnimeLinks(anime *arn.Anime, user *arn.User)
Icon("external-link")
span= link.Title
a.light-button(href="https://kitsu.io/anime/" + anime.ID, target="_blank", rel="noopener")
Icon("external-link")
span Kitsu
each mapping in anime.Mappings
a.light-button(href=mapping.Link(), target="_blank", rel="noopener")
Icon("external-link")

View File

@ -0,0 +1,24 @@
package main
import (
"fmt"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Adding kitsu/anime mappings")
defer color.Green("Finished")
defer arn.Node.Close()
for anime := range arn.StreamAnime() {
fmt.Println(anime.ID, anime)
anime.SetMapping("kitsu/anime", anime.ID)
anime.Save()
}
time.Sleep(time.Second)
}

View File

@ -1,48 +0,0 @@
package main
import (
"fmt"
"github.com/animenotifier/arn"
"github.com/animenotifier/mal"
"github.com/fatih/color"
)
func main() {
defer arn.Node.Close()
count := 0
for anime := range arn.StreamAnime() {
if len(anime.Genres) > 0 {
continue
}
malID := anime.GetMapping("myanimelist/anime")
if malID == "" {
continue
}
malAnimeObj, err := arn.MAL.Get("Anime", malID)
if err != nil {
continue
}
malAnime := malAnimeObj.(*mal.Anime)
if len(malAnime.Genres) == 0 {
continue
}
anime.Genres = malAnime.Genres
anime.Save()
count++
fmt.Println(anime.ID, anime, anime.Genres)
}
color.Green("Added genres to %d anime", count)
}