New Kitsu import
This commit is contained in:
parent
60f568b9b1
commit
1bc62ab105
@ -112,6 +112,7 @@ func getMatches(ctx *aero.Context) ([]*arn.KitsuMatch, string) {
|
||||
|
||||
// findAllMatches returns all matches for the anime inside an anilist anime list.
|
||||
func findAllMatches(library chan *kitsu.LibraryEntry) []*arn.KitsuMatch {
|
||||
allAnime := arn.AllAnime()
|
||||
matches := []*arn.KitsuMatch{}
|
||||
|
||||
for item := range library {
|
||||
@ -122,7 +123,7 @@ func findAllMatches(library chan *kitsu.LibraryEntry) []*arn.KitsuMatch {
|
||||
|
||||
matches = append(matches, &arn.KitsuMatch{
|
||||
KitsuItem: item,
|
||||
ARNAnime: arn.FindKitsuAnime(item.Anime.ID),
|
||||
ARNAnime: arn.FindKitsuAnime(item.Anime.ID, allAnime),
|
||||
})
|
||||
}
|
||||
|
||||
|
34
patches/generate-anime-ids/generate-anime-ids.go
Normal file
34
patches/generate-anime-ids/generate-anime-ids.go
Normal file
@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Generating anime IDs")
|
||||
|
||||
defer color.Green("Finished")
|
||||
defer arn.Node.Close()
|
||||
|
||||
allAnime := arn.AllAnime()
|
||||
|
||||
sort.Slice(allAnime, func(i, j int) bool {
|
||||
aID, _ := strconv.Atoi(allAnime[i].ID)
|
||||
bID, _ := strconv.Atoi(allAnime[j].ID)
|
||||
|
||||
return aID < bID
|
||||
})
|
||||
|
||||
for counter, anime := range allAnime {
|
||||
newID := arn.GenerateID("Anime")
|
||||
fmt.Printf("[%d / %d] Old [%s] New [%s] %s\n", counter+1, len(allAnime), color.YellowString(anime.ID), color.GreenString(newID), anime)
|
||||
anime.SetID(newID)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user