Minor changes
This commit is contained in:
parent
dfa72d5df0
commit
9950adbf9e
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
@ -30,7 +30,7 @@ func importList(animeListItems []*arn.AniListAnimeListItem) {
|
|||||||
imported := []*arn.Anime{}
|
imported := []*arn.Anime{}
|
||||||
|
|
||||||
for _, item := range animeListItems {
|
for _, item := range animeListItems {
|
||||||
anime := findAnimeByName(item.Anime)
|
anime := findAniListAnime(item.Anime)
|
||||||
if anime != nil {
|
if anime != nil {
|
||||||
// fmt.Println(item.Anime.TitleRomaji, "=>", anime.Title.Romaji)
|
// fmt.Println(item.Anime.TitleRomaji, "=>", anime.Title.Romaji)
|
||||||
imported = append(imported, anime)
|
imported = append(imported, anime)
|
||||||
@ -40,7 +40,14 @@ func importList(animeListItems []*arn.AniListAnimeListItem) {
|
|||||||
color.Green("%d / %d", len(imported), len(animeListItems))
|
color.Green("%d / %d", len(imported), len(animeListItems))
|
||||||
}
|
}
|
||||||
|
|
||||||
func findAnimeByName(search *arn.AniListAnime) *arn.Anime {
|
func findAniListAnime(search *arn.AniListAnime) *arn.Anime {
|
||||||
|
match, err := arn.GetAniListToAnime(strconv.Itoa(search.ID))
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
anime, _ := arn.GetAnime(match.AnimeID)
|
||||||
|
return anime
|
||||||
|
}
|
||||||
|
|
||||||
var mostSimilar *arn.Anime
|
var mostSimilar *arn.Anime
|
||||||
var similarity float64
|
var similarity float64
|
||||||
|
|
||||||
@ -75,7 +82,7 @@ func findAnimeByName(search *arn.AniListAnime) *arn.Anime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if similarity >= 0.92 {
|
if similarity >= 0.92 {
|
||||||
fmt.Printf("MATCH: %s => %s (%.2f)\n", search.TitleRomaji, mostSimilar.Title.Romaji, similarity)
|
// fmt.Printf("MATCH: %s => %s (%.2f)\n", search.TitleRomaji, mostSimilar.Title.Romaji, similarity)
|
||||||
return mostSimilar
|
return mostSimilar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user