From 487df034d47db5819a6190e28419280d43deb954 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 9 Mar 2018 05:36:43 +0100 Subject: [PATCH] Updated sync tool --- jobs/sync-anime/sync-anime.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jobs/sync-anime/sync-anime.go b/jobs/sync-anime/sync-anime.go index 75057669..dbfdde32 100644 --- a/jobs/sync-anime/sync-anime.go +++ b/jobs/sync-anime/sync-anime.go @@ -30,9 +30,14 @@ func main() { } } -func sync(data *kitsu.Anime) *arn.Anime { +func sync(data *kitsu.Anime) { anime, err := arn.GetAnime(data.ID) + // This stops overwriting existing data + if err == nil || anime != nil { + return + } + if err != nil { if strings.Contains(err.Error(), "not found") { anime = &arn.Anime{ @@ -150,6 +155,4 @@ func sync(data *kitsu.Anime) *arn.Anime { // Log fmt.Println(color.GreenString("✔"), anime.ID, anime.Title.Canonical) - - return anime }