From 60c0baa9ab25036d513b5731a84d4e570c2767ef Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Mon, 4 Nov 2019 16:54:34 +0900 Subject: [PATCH] Added anime characters fix --- .../anime-characters-fix.go | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/anime-characters-fix/anime-characters-fix.go diff --git a/patches/anime-characters-fix/anime-characters-fix.go b/patches/anime-characters-fix/anime-characters-fix.go new file mode 100644 index 00000000..4a096a01 --- /dev/null +++ b/patches/anime-characters-fix/anime-characters-fix.go @@ -0,0 +1,25 @@ +package main + +import ( + "github.com/akyoto/color" + "github.com/animenotifier/notify.moe/arn" +) + +func main() { + defer arn.Node.Close() + count := 0 + + for anime := range arn.StreamAnime() { + if anime.Characters() == nil { + characters := &arn.AnimeCharacters{ + AnimeID: anime.ID, + Items: nil, + } + + characters.Save() + count++ + } + } + + color.Green("Added %d missing AnimeCharacter objects", count) +}