Delete ServiceMatch caching

This commit is contained in:
Eduard Urbach 2018-03-23 03:29:56 +01:00
parent d4b80f006a
commit fc5da638c0
4 changed files with 6 additions and 54 deletions

View File

@ -112,16 +112,9 @@ func findAllMatches(library chan *kitsu.LibraryEntry) []*arn.KitsuMatch {
continue
}
var anime *arn.Anime
connection, err := arn.GetKitsuToAnime(item.Anime.ID)
if err == nil {
anime, _ = arn.GetAnime(connection.AnimeID)
}
matches = append(matches, &arn.KitsuMatch{
KitsuItem: item,
ARNAnime: anime,
ARNAnime: arn.FindKitsuAnime(item.Anime.ID),
})
}

View File

@ -99,19 +99,13 @@ func getMatches(ctx *aero.Context) ([]*arn.MyAnimeListMatch, string) {
// findAllMatches returns all matches for the anime inside an anilist anime list.
func findAllMatches(animeList *mal.AnimeList) []*arn.MyAnimeListMatch {
allAnime := arn.AllAnime()
matches := []*arn.MyAnimeListMatch{}
for _, item := range animeList.Items {
var anime *arn.Anime
connection, err := arn.GetMyAnimeListToAnime(item.AnimeID)
if err == nil {
anime, _ = arn.GetAnime(connection.AnimeID)
}
matches = append(matches, &arn.MyAnimeListMatch{
MyAnimeListItem: item,
ARNAnime: anime,
ARNAnime: arn.FindMyAnimeListAnime(item.AnimeID, allAnime),
})
}

View File

@ -1,37 +0,0 @@
package main
import (
"strconv"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
defer arn.Node.Close()
for anime := range arn.StreamAnime() {
malID := anime.GetMapping("myanimelist/anime")
if malID == "" {
continue
}
// Assure the string represents a number
malNum, _ := strconv.Atoi(malID)
normalizedID := strconv.Itoa(malNum)
if malID != normalizedID {
color.Red("%s does not match %d", malID, normalizedID)
continue
}
// Save
arn.DB.Set("MyAnimeListToAnime", malID, &arn.MyAnimeListToAnime{
AnimeID: anime.ID,
ServiceID: malID,
Edited: arn.DateTimeUTC(),
EditedBy: "",
})
}
}

View File

@ -7,9 +7,11 @@ import (
)
func main() {
color.Yellow("Iterating through AniList anime to generate new mappings")
defer arn.Node.Close()
arn.PanicOnError(anilist.Authorize())
err := anilist.Authorize()
arn.PanicOnError(err)
color.Green(anilist.AccessToken)
allAnime := arn.AllAnime()