Skip to content

Commit a9aba20

Browse files
committed
fix(mal): propagate changes from mal
1 parent 2279e93 commit a9aba20

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/domain/mal.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func ScrapeMal() {
127127
//extensions.Referer(cc)
128128

129129
as := NewAnimeService(cc)
130-
a := GetAnime(AniDBIDPath)
130+
a := updateMalfromAnidb()
131131
as.AnimeSlice = a
132132
r := regexp.MustCompile(`aid=(\d+)`)
133133
as.c.OnHTML("a[href]", func(e *colly.HTMLElement) {
@@ -166,3 +166,19 @@ func ScrapeMal() {
166166

167167
StoreAnime(as.AnimeSlice, AniDBIDPath)
168168
}
169+
170+
func updateMalfromAnidb() []Anime {
171+
mal := GetAnime(MalIDPath)
172+
173+
for i := range mal {
174+
175+
animeInfo, exists := typeDateMap[mal[i].MalID]
176+
if !exists {
177+
continue
178+
}
179+
180+
mal[i].AnidbID = animeInfo.AnidbID
181+
}
182+
183+
return mal
184+
}

0 commit comments

Comments
 (0)