mangadata

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Unlicense Imports: 4 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter

type Chapter interface {
	fmt.Stringer

	Info() ChapterInfo

	// Volume gets the Volume that this Chapter is relevant to.
	//
	// Implementation should not make any external requests
	// nor be computationally heavy.
	Volume() Volume
}

Chapter is what Volume consists of. Each chapter is about 24–40 pages.

type ChapterInfo

type ChapterInfo struct {
	// Title is the title of chapter.
	Title string `json:"title"`

	// URL is the url leading to chapter web page.
	URL string `json:"url"`

	// Number of the chapter.
	//
	// Float type allows for extra chapters that usually have
	// numbering like the following: 10.5, 101.1, etc..
	Number float32 `json:"number"`

	// Date is the chapter publication date.
	Date metadata.Date `json:"date"`

	// ScanlationGroup is the group that did the scan/translation.
	//
	// If not an official publication, most of the chapters will belong
	// to a scanlation group.
	ScanlationGroup string `json:"scanlation_group"`
}

ChapterInfo is the general information for the chapter.

type ChapterWithComicInfoXML

type ChapterWithComicInfoXML interface {
	Chapter

	// ComicInfoXML will be used to write ComicInfo.xml file.
	//
	// Implementation should not make any external requests.
	// If found is false then mangal will try to search on Anilist for the
	// relevant manga.
	ComicInfoXML() (comicInfoXML metadata.ComicInfoXML, found bool, err error)
}

ChapterWithComicInfoXML is a Chapter with an already associated ComicInfoXML.

The associated ComicInfoXML will be used instead of the one generated from the metadata.

type Manga

type Manga interface {
	fmt.Stringer

	Info() MangaInfo

	// Metadata gets the associated metadata of the manga.
	//
	// In its unchanged state, it's the basic metadata that is found in the provider itself.
	Metadata() metadata.Metadata

	// SetMetadata will replace the current metadata.
	//
	// Useful when updating metadata fields. Its implementation should keep the
	// same pointer address intact, only updating the underlying data.
	SetMetadata(metadata metadata.Metadata)
}

Manga should provide basic information and its metadata found in the provider.

type MangaInfo

type MangaInfo struct {
	// Title of the manga.
	Title string `json:"title"`

	// URL leading to manga page web page.
	URL string `json:"url"`

	// ID of the Manga.
	//
	// It must be unique within its provider. It will be
	// part of the URL in most cases.
	ID string `json:"id"`

	// Cover is the cover image url.
	Cover string `json:"cover"`

	// Banner is the banner image url.
	//
	// Not all providers contain a banner image.
	Banner string `json:"banner"`
}

MangaInfo is the general indispensable information for the manga.

type MangaWithSeriesJSON

type MangaWithSeriesJSON interface {
	Manga

	// SeriesJSON will be used to write series.json file.
	//
	// Implementation should not make any external requests.
	// If found is false then mangal will try to search on Anilist for the
	// relevant manga.
	SeriesJSON() (seriesJSON metadata.SeriesJSON, found bool, err error)
}

MangaWithSeriesJSON is a Manga with an already associated SeriesJSON.

The associated SeriesJSON will be used instead of the one generated from the metadata.

type Metadata added in v0.17.0

type Metadata struct {
	EnglishTitle      string          `json:"english_title"`
	RomajiTitle       string          `json:"romaji_title"`
	NativeTitle       string          `json:"native_title"`
	Synonyms          []string        `json:"synonyms"`
	CommunityScore    float32         `json:"community_score"`
	Summary           string          `json:"summary"`
	CoverImage        string          `json:"cover_image"`
	BannerImage       string          `json:"banner_image"`
	TagList           []string        `json:"tag_list"`
	GenreList         []string        `json:"genre_list"`
	CharacterList     []string        `json:"character_list"`
	AuthorList        []string        `json:"author_list"`
	ArtistList        []string        `json:"artist_list"`
	TranslatorList    []string        `json:"translator_list"`
	LettererList      []string        `json:"letterer_list"`
	DateStart         metadata.Date   `json:"date_start"`
	DateEnd           metadata.Date   `json:"date_end"`
	ProviderPublisher string          `json:"provider_publisher"`
	PublicationStatus metadata.Status `json:"publication_status"`
	PublicationFormat string          `json:"publication_format"`
	CountryOfOrigin   string          `json:"country_of_origin"`
	ChapterCount      int             `json:"chapter_count"`
	ExtraNotes        string          `json:"extra_notes"`
	SourceURL         string          `json:"source_url"`
	ProviderID        string          `json:"provider_id"`
	ProviderIDCode    string          `json:"provider_id_code"`
	OtherIDs          []metadata.ID   `json:"other_ids"`
}

Metadata is a metadata.Metadata implementation for a generic Provider Metadata, usable by mangadata implementations.

func (*Metadata) AlternateTitles added in v0.17.0

func (m *Metadata) AlternateTitles() []string

AlternateTitles is a list of alternative titles in order of relevance.

func (*Metadata) Artists added in v0.17.0

func (m *Metadata) Artists() []string

Artists is the list of artists, in order of relevance.

func (*Metadata) Authors added in v0.17.0

func (m *Metadata) Authors() []string

Authors (or Writers) is the list of authors, in order of relevance. Must contain at least one artist.

func (*Metadata) Banner added in v0.17.0

func (m *Metadata) Banner() string

BannerImage is the banner image of the manga.

func (*Metadata) Chapters added in v0.17.0

func (m *Metadata) Chapters() int

Chapter count until this point.

func (*Metadata) Characters added in v0.17.0

func (m *Metadata) Characters() []string

Characters is the list of characters, in order of relevance.

func (*Metadata) Country added in v0.17.0

func (m *Metadata) Country() string

Country of origin of the manga. ISO 3166-1 alpha-2 country code.

func (*Metadata) Cover added in v0.17.0

func (m *Metadata) Cover() string

CoverImage is the cover image of the manga.

func (*Metadata) Description added in v0.17.0

func (m *Metadata) Description() string

Description is the description/summary for the manga.

func (*Metadata) EndDate added in v0.17.0

func (m *Metadata) EndDate() metadata.Date

EndDate is the date the manga ended publishing.

func (*Metadata) ExtraIDs added in v0.17.0

func (m *Metadata) ExtraIDs() []metadata.ID

ExtraIDs is a list of extra available IDs in the metadata provider. Each extra ID must be valid (ID.Validate).

func (*Metadata) Format added in v0.17.0

func (m *Metadata) Format() string

Format the original publication.

For example: TBP, HC, Web, Digital, etc..

func (*Metadata) Genres added in v0.17.0

func (m *Metadata) Genres() []string

Genres is the list of genres associated with the manga.

func (*Metadata) ID added in v0.17.0

func (m *Metadata) ID() metadata.ID

ID is the ID information of the metadata. Must be valid (ID.Validate).

func (*Metadata) Letterers added in v0.17.0

func (m *Metadata) Letterers() []string

Letterers is the list of letterers, in order of relevance.

func (*Metadata) Notes added in v0.17.0

func (m *Metadata) Notes() string

Extra notes to be added.

func (*Metadata) Publisher added in v0.17.0

func (m *Metadata) Publisher() string

Publisher of the manga.

func (*Metadata) Score added in v0.17.0

func (m *Metadata) Score() float32

Score is the community score for the manga.

Accepted values are between 0.0 and 5.0.

func (*Metadata) StartDate added in v0.17.0

func (m *Metadata) StartDate() metadata.Date

StartDate is the date the manga started publishing. Must be non-zero.

func (*Metadata) Status added in v0.17.0

func (m *Metadata) Status() metadata.Status

Current status of the manga. Must be non-empty.

One of: FINISHED, RELEASING, NOT_YET_RELEASED, CANCELLED, HIATUS

func (*Metadata) String added in v0.17.0

func (m *Metadata) String() string

String is the short representation of the manga. Must be non-empty.

At the minimum it should return "`Title` (`Year`)", else "`Title` (`Year`) [`IDCode`id-`ID`]" if available.

func (*Metadata) Tags added in v0.17.0

func (m *Metadata) Tags() []string

Tags is the list of tags associated with the manga.

func (*Metadata) Title added in v0.17.0

func (m *Metadata) Title() string

Title is the English title of the manga. Must be non-empty.

If English is not available, then in in order of availability: Romaji (the romanized title) or Native (usually Kanji).

func (*Metadata) Translators added in v0.17.0

func (m *Metadata) Translators() []string

Translators is the list of translators, in order of relevance.

func (*Metadata) URL added in v0.17.0

func (m *Metadata) URL() string

URL is the source URL of the metadata.

type Page

type Page interface {
	fmt.Stringer

	// Extension gets the image extension of this page.
	// An extension must start with a dot.
	//
	// For example: .jpeg .png
	Extension() string

	// Chapter gets the Chapter that this Page is relevant to.
	//
	// Implementation should not make any external requests
	// nor be computationally heavy.
	Chapter() Chapter
}

Page is what Chapter consists of.

type PageWithImage

type PageWithImage interface {
	Page

	// Image gets the image contents.
	//
	// Implementation should not make any external requests.
	// Should only be exposed if the Page already contains image contents.
	Image() []byte

	// SetImage sets the image contents. This is used by DownloadOptions.ImageTransformer.
	SetImage(newImage []byte)
}

PageWithImage is a Page with already downloaded image.

The associated image will be used instead of downloading one.

type Volume

type Volume interface {
	fmt.Stringer

	Info() VolumeInfo

	// Manga gets the Manga that this Volume is relevant to.
	//
	// Implementation should not make any external requests
	// nor be computationally heavy.
	Manga() Manga
}

Volume of a manga. If a series is popular enough, its chapters are then collected and published into volumes, which usually feature a few chapters of the overall story. Most Manga series are long-running and can span multiple volumes.

At least one volume is expected.

type VolumeInfo

type VolumeInfo struct {
	// Number of the volume.
	Number float32 `json:"number"`
}

VolumeInfo is the general information for the volume.

Jump to

Keyboard shortcuts

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