From 007e2e90ecee86cf1e9e00b91b78f2403df49e62 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 1 Nov 2018 08:31:11 +0900 Subject: [PATCH] Updated MAL sync --- jobs/mal-sync/character.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/jobs/mal-sync/character.go b/jobs/mal-sync/character.go index a14fbe79..0d18d2b7 100644 --- a/jobs/mal-sync/character.go +++ b/jobs/mal-sync/character.go @@ -25,7 +25,7 @@ func parseCharacterDescription(input string) (output string, attributes []*arn.C var lastAttribute *arn.CharacterAttribute for _, line := range lines { - line = strings.Replace(line, " (\n)", "", -1) + // line = strings.Replace(line, " (\n)", "", -1) // Remove all kinds of starting and ending parantheses. if strings.HasPrefix(line, "(") { @@ -33,27 +33,27 @@ func parseCharacterDescription(input string) (output string, attributes []*arn.C line = strings.TrimSuffix(line, ")") } - line = strings.TrimSuffix(line, " (") - line = strings.TrimPrefix(line, ")") + if !strings.Contains(line, ":") { + // Remove list indicators + line = strings.TrimPrefix(line, "- ") + line = strings.TrimPrefix(line, "* ") - parts := strings.Split(line, ":") - - if len(parts) < 2 { // Add to previous attribute if lastAttribute != nil { - lastAttribute.Value += ", " + line + if lastAttribute.Value != "" { + lastAttribute.Value += ", " + } + + lastAttribute.Value += line } continue } + parts := strings.Split(line, ":") name := strings.TrimSpace(parts[0]) value := strings.TrimSpace(parts[1]) - if value == "" || value == `"` { - continue - } - lastAttribute = &arn.CharacterAttribute{ Name: name, Value: value,