mirror of
https://github.com/gabehf/sonarr-anime-importer.git
synced 2026-03-17 11:16:25 -07:00
use AniList's MAL ID mapping instead of Kometa
This commit is contained in:
parent
cdd7b67003
commit
e96577b5bc
2 changed files with 7 additions and 13 deletions
12
main.go
12
main.go
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue