Commit 625c335969
Unsigned
Layout: unified · split
internal/anilist.go +6 −2
| @@ -28,7 +28,12 @@ func GetAnimeMap(animeList AnimeList) map[string]string { | ||
| 28 | 28 | // Helper function to populate the map from a slice of entries |
| 29 | 29 | populateMap := func(entries []Entry) { |
| 30 | 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 | 47 | return animeMap |
| 43 | 48 | } |
| 44 | ||
| 45 | 49 | // SearchAnimeAnilist sends the query to AniList and returns a map of title to ID |
| 46 | 50 | func SearchAnimeAnilist(query, token string) (map[string]string, error) { |
| 47 | 51 | url := "https://graphql.anilist.co" |