From 82ea2beb9ef2f1f30fb8413d51e247902a2dc310 Mon Sep 17 00:00:00 2001 From: Neshura <neshura@neshweb.net> Date: Tue, 18 Feb 2025 23:25:46 +0100 Subject: [PATCH] Fix Creators not being written to ComicInfo.xml --- jnc/jnc.go | 14 +++++++------- main.go | 9 ++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/jnc/jnc.go b/jnc/jnc.go index 911772e..44eb389 100644 --- a/jnc/jnc.go +++ b/jnc/jnc.go @@ -115,17 +115,17 @@ type Creator struct { OriginalName string `json:"originalName "` } -func (creators *Creators) Contains(name string) bool { - return slices.ContainsFunc(*creators, func(c Creator) bool { - return c.Name == name +func (creators Creators) Contains(role string) bool { + return slices.ContainsFunc(creators, func(c Creator) bool { + return c.Role == role }) } -func (creators *Creators) Get(name string) *Creator { - idx := slices.IndexFunc(*creators, func(c Creator) bool { - return c.Name == name +func (creators Creators) Get(role string) *Creator { + idx := slices.IndexFunc(creators, func(c Creator) bool { + return c.Role == role }) - return &(*creators)[idx] + return &(creators)[idx] } type VolumeAugmented struct { diff --git a/main.go b/main.go index 4a2da05..abea0c7 100644 --- a/main.go +++ b/main.go @@ -574,8 +574,15 @@ func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmente comicInfo.Writer = vInfo.Creators.Get("AUTHOR").Name } - if vInfo.Creators.Contains("ILLUSTRATOR") { + if vInfo.Creators.Contains("LETTERER") { + comicInfo.Letterer = vInfo.Creators.Get("LETTERER").Name + } else if vInfo.Creators.Contains("ILLUSTRATOR") { comicInfo.Letterer = vInfo.Creators.Get("ILLUSTRATOR").Name + } + + if vInfo.Creators.Contains("ARTIST") { + comicInfo.CoverArtist = vInfo.Creators.Get("ARTIST").Name + } else if vInfo.Creators.Contains("ILLUSTRATOR") { comicInfo.CoverArtist = vInfo.Creators.Get("ILLUSTRATOR").Name }