use AniList's MAL ID mapping instead of Kometa

This commit is contained in:
Gabe Farrell 2025-04-07 02:05:17 -04:00
parent cdd7b67003
commit e96577b5bc
2 changed files with 7 additions and 13 deletions

12
main.go
View file

@ -26,9 +26,8 @@ type AnimeEntry struct {
AnilistId int `json:"anilist_id"`
}
type ConcurrentMap struct {
mal map[int]int
anilist map[int]int
mut sync.RWMutex
mal map[int]int
mut sync.RWMutex
}
func (m *ConcurrentMap) GetByMalId(i int) int {
@ -36,11 +35,6 @@ func (m *ConcurrentMap) GetByMalId(i int) int {
defer m.mut.RUnlock()
return m.mal[i]
}
func (m *ConcurrentMap) GetByAnilistId(i int) int {
m.mut.RLock()
defer m.mut.RUnlock()
return m.anilist[i]
}
var lastBuiltAnimeIdList time.Time
@ -87,7 +81,6 @@ func buildIdMap(idMap *ConcurrentMap) {
log.Fatal("Error unmarshalling anime_ids.json: ", err)
}
idMap.mal = make(map[int]int, 0)
idMap.anilist = make(map[int]int, 0)
for _, entry := range animeMap {
if entry.MalId == nil {
continue
@ -112,7 +105,6 @@ func buildIdMap(idMap *ConcurrentMap) {
if entry.AnilistId == 0 {
continue
}
idMap.anilist[entry.AnilistId] = entry.TvdbId
}
lastBuiltAnimeIdList = time.Now()
}