Commit 625c335969

625c3359692acfdee45f9514cf04ad4a53902629

parent: 22c5b81107

Unsigned

Wraient <wraient.911@gmail.com> · 2024-10-22 10:57 UTC

Fix: That was hard to debug

Layout: unified · split

internal/anilist.go +6 −2
@@ -28,7 +28,12 @@ func GetAnimeMap(animeList AnimeList) map[string]string {
28 // Helper function to populate the map from a slice of entries 28 // Helper function to populate the map from a slice of entries
29 populateMap := func(entries []Entry) { 29 populateMap := func(entries []Entry) {
30 for _, entry := range entries { 30 for _, entry := range entries {
31 animeMap[strconv.Itoa(entry.Media.ID)] = entry.Media.Title.English 31 // Only include entries with a non-empty English title
32 if entry.Media.Title.English != "" {
33 animeMap[strconv.Itoa(entry.Media.ID)] = entry.Media.Title.English
34 } else {
35 animeMap[strconv.Itoa(entry.Media.ID)] = entry.Media.Title.Romaji
36 }
32 } 37 }
33 } 38 }
34 39
@@ -41,7 +46,6 @@ func GetAnimeMap(animeList AnimeList) map[string]string {
41 46
42 return animeMap 47 return animeMap
43} 48}
44
45// SearchAnimeAnilist sends the query to AniList and returns a map of title to ID 49// SearchAnimeAnilist sends the query to AniList and returns a map of title to ID
46func SearchAnimeAnilist(query, token string) (map[string]string, error) { 50func SearchAnimeAnilist(query, token string) (map[string]string, error) {
47 url := "https://graphql.anilist.co" 51 url := "https://graphql.anilist.co"