comicinfo

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Separator string = ","

Functions

func AddValue added in v0.9.0

func AddValue(str string, values ...string) string

Add values to given string, by separator. This function will also ensure no duplicate item appear in final string.

func Save

func Save(info *ComicInfo, path string) error

Save the ComicInfo struct to "ComicInfo.xml" file. If directory is not exist, this function will created by itself.

The path must have the last element equal to "ComicInfo.xml".

Types

type AgeRating

type AgeRating string

The AgeRating Type for comicInfo

const (
	AgeRating_Unknown        AgeRating = "Unknown"
	AgeRating_AdultsOnly18   AgeRating = "Adults Only 18+"
	AgeRating_EarlyChildhood AgeRating = "Early Childhood"
	AgeRating_Everyone       AgeRating = "Everyone"
	AgeRating_Everyone10Plus AgeRating = "Everyone 10+"
	AgeRating_G              AgeRating = "G"
	AgeRating_KidsToAdults   AgeRating = "Kids to Adults"
	AgeRating_M              AgeRating = "M"
	AgeRating_MA15Plus       AgeRating = "MA15+"
	AgeRating_Mature17Plus   AgeRating = "Mature 17+"
	AgeRating_PG             AgeRating = "PG"
	AgeRating_R18Plus        AgeRating = "R18+"
	AgeRating_RatingPending  AgeRating = "Rating Pending"
	AgeRating_Teen           AgeRating = "Teen"
	AgeRating_X18Plus        AgeRating = "X18+"
)

type ComicInfo

type ComicInfo struct {
	XMLName xml.Name `xml:"ComicInfo"`
	Xsi     string   `xml:"xmlns:xsi,attr,omitempty"`
	Xsd     string   `xml:"xmlns:xsd,attr,omitempty"`

	Title           string        `xml:"Title" json:"Title"`
	Series          string        `xml:"Series" json:"Series"`
	Number          string        `xml:"Number" json:"Number"`
	Count           int           `xml:"Count,omitempty" json:"Count"`
	Volume          int           `xml:"Volume" json:"Volume"`
	AlternateSeries string        `xml:"AlternateSeries" json:"AlternateSeries"`
	AlternateNumber string        `xml:"AlternateNumber" json:"AlternateNumber"`
	AlternateCount  int           `xml:"AlternateCount,omitempty" json:"AlternateCount"`
	StoryArc        string        `xml:"StoryArc" json:"StoryArc"`
	StoryArcNumber  string        `xml:"StoryArcNumber" json:"StoryArcNumber"`
	SeriesGroup     string        `xml:"SeriesGroup" json:"SeriesGroup"`
	Summary         EscapedString `xml:"Summary" json:"Summary"`
	Notes           string        `xml:"Notes" json:"Notes"`
	Year            int           `xml:"Year,omitempty" json:"Year"`
	Month           int           `xml:"Month,omitempty" json:"Month"`
	Day             int           `xml:"Day,omitempty" json:"Day"`
	Writer          string        `xml:"Writer" json:"Writer"`
	Penciller       string        `xml:"Penciller,omitempty" json:"Penciller"`
	Inker           string        `xml:"Inker,omitempty" json:"Inker"`
	Colorist        string        `xml:"Colorist,omitempty" json:"Colorist"`
	Letterer        string        `xml:"Letterer,omitempty" json:"Letterer"`
	CoverArtist     string        `xml:"CoverArtist,omitempty" json:"CoverArtist"`
	Editor          string        `xml:"Editor,omitempty" json:"Editor"`
	Translator      string        `xml:"Translator,omitempty" json:"Translator"`
	Publisher       string        `xml:"Publisher" json:"Publisher"`
	Imprint         string        `xml:"Imprint" json:"Imprint"`
	Genre           string        `xml:"Genre" json:"Genre"`
	Tags            string        `xml:"Tags" json:"Tags"`
	Web             string        `xml:"Web,omitempty" json:"Web"`
	PageCount       int           `xml:"PageCount" json:"PageCount"`
	LanguageISO     string        `xml:"LanguageISO" json:"LanguageISO"`
	Format          string        `xml:"Format" json:"Format"`
	AgeRating       AgeRating     `xml:"AgeRating" json:"AgeRating"`
	BlackAndWhite   YesNo         `xml:"BlackAndWhite,omitempty" json:"BlackAndWhite"`
	Manga           Manga         `xml:"Manga" json:"Manga"`
	Characters      string        `xml:"Characters" json:"Characters"`
	Teams           string        `xml:"Teams" json:"Teams"`
	Locations       string        `xml:"Locations" json:"Locations"`
	ScanInformation string        `xml:"ScanInformation" json:"ScanInformation"`

	Pages               []ComicPageInfo `xml:"Pages>Page" json:"Pages"`
	CommunityRating     float64         `xml:"CommunityRating,omitempty" json:"CommunityRating"`
	MainCharacterOrTeam string          `xml:"MainCharacterOrTeam,omitempty" json:"MainCharacterOrTeam"`
	Review              string          `xml:"Review,omitempty" json:"Review"`
	GTIN                string          `xml:"GTIN,omitempty" json:"GTIN"`
}

The Go Struct Version for ComicInfo.

Developer are suggest to use New() to create a new struct instead of ComicInfo{}

func Load

func Load(path string) (*ComicInfo, error)

Load XML file to comicInfo struct in go.

path MUST has base of "ComicInfo.xml", or it will return error for invalid XML.

func New

func New() ComicInfo

Create a new ComicInfo Instance.

func (*ComicInfo) AddGenre added in v0.9.0

func (c *ComicInfo) AddGenre(genre ...string)

Add genres to the comic info container. This function will handle the comma separation automatically.

func (*ComicInfo) AddPublisher added in v0.9.0

func (c *ComicInfo) AddPublisher(publisher ...string)

Add publishers to the comic info container. This function will handle the comma separation automatically.

func (*ComicInfo) AddTags

func (c *ComicInfo) AddTags(tags ...string)

Add Tags to the comic info container. This function will handle the comma separation automatically.

func (*ComicInfo) AddTranslator added in v0.9.0

func (c *ComicInfo) AddTranslator(translator ...string)

Add translators to the comic info container. This function will handle the comma separation automatically.

type ComicPageInfo

type ComicPageInfo struct {
	XMLName xml.Name `xml:"Page"`

	Image       int           `xml:"Image,attr" json:"Image"`
	Type        ComicPageType `xml:"Type,attr,omitempty" json:"Type"`
	DoublePage  bool          `xml:"DoublePage,attr,omitempty" json:"DoublePage"`
	ImageSize   int64         `xml:"ImageSize,attr,omitempty" json:"ImageSize"`
	Key         string        `xml:"Key,attr,omitempty" json:"Key"`
	Bookmark    string        `xml:"Bookmark,attr,omitempty" json:"Bookmark"`
	ImageWidth  string        `xml:"ImageWidth,attr,omitempty" json:"ImageWidth"`
	ImageHeight string        `xml:"ImageHeight,attr,omitempty" json:"ImageHeight"`
}

The Go Struct Version for ComicPageInfo, used to store page information.

type ComicPageType

type ComicPageType string

The ComicPageType Type for comicInfo

const (
	ComicPageType_FrontCover    ComicPageType = "FrontCover"
	ComicPageType_InnerCover    ComicPageType = "InnerCover"
	ComicPageType_Roundup       ComicPageType = "Roundup"
	ComicPageType_Story         ComicPageType = "Story"
	ComicPageType_Advertisement ComicPageType = "Advertisement"
	ComicPageType_Editorial     ComicPageType = "Editorial"
	ComicPageType_Letters       ComicPageType = "Letters"
	ComicPageType_Preview       ComicPageType = "Preview"
	ComicPageType_BackCover     ComicPageType = "BackCover"
	ComicPageType_Other         ComicPageType = "Other"
	ComicPageType_Deleted       ComicPageType = "Deleted"
)

type EscapedString

type EscapedString struct {
	InnerXML string `xml:",innerxml" json:"InnerXML"`
}

Escape String for XML. Prevent appear &#39 .etc

type Manga

type Manga string

The Manga Type for comicInfo

const (
	Manga_Unknown           Manga = "Unknown"
	Manga_No                Manga = "No"
	Manga_Yes               Manga = "Yes"
	Manga_YesAndRightToLeft Manga = "YesAndRightToLeft"
)

type YesNo

type YesNo string

The YesNo Type for comicInfo

const (
	YesNo_Unknown YesNo = "Unknown"
	YesNo_No      YesNo = "No"
	YesNo_Yes     YesNo = "Yes"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL