Fix Creators not being written to ComicInfo.xml

This commit is contained in:
Neshura 2025-02-18 23:25:46 +01:00
parent 903f7142ce
commit 82ea2beb9e
Signed by: Neshura
GPG key ID: 4E2D47B1374C297D
2 changed files with 15 additions and 8 deletions

View file

@ -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 {

View file

@ -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
}