Added kitsu anime ID mapping
This commit is contained in:
parent
a8379ddc8c
commit
2f7dc5b662
@ -126,10 +126,6 @@ component AnimeLinks(anime *arn.Anime, user *arn.User)
|
||||
a.light-button(href=link.URL, target="_blank", rel="noopener")
|
||||
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")
|
||||
|
24
patches/add-kitsu-mapping/add-kitsu-mapping.go
Normal file
24
patches/add-kitsu-mapping/add-kitsu-mapping.go
Normal 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)
|
||||
}
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user