fb2

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCoverImage added in v1.0.0

func GetCoverImage(stock string, book *model.Book) (image.Image, error)

Types

type Binary

type Binary struct {
	ID          string `xml:"id,attr"`
	ContentType string `xml:"content-type,attr"`
	Content     []byte `xml:",chardata"`
}

Any binary data that is required for the presentation of this book in base64 format. Currently only images are used.

func (*Binary) String

func (b *Binary) String() string

type FB2

type FB2 struct {
	FictionBook xml.Name `xml:"FictionBook"` // Root element
	Description struct {
		TitleInfo struct {
			Authors []struct {
				FirstName  string `xml:"first-name"`
				MiddleName string `xml:"middle-name"`
				LastName   string `xml:"last-name"`
			} `xml:"author"`
			BookTitle  string   `xml:"book-title"` // Book title
			Genres     []string `xml:"genre"`      // Genre of this book
			Annotation struct {
				P []string `xml:"p"`
			} `xml:"annotation"`
			Keywords string `xml:"keywords"` // Any keywords for this book, intended for use in search engines
			Date     string `xml:"date"`     // Date this book was written, can be not exact, e.g. 1863-1867.
			Lang     string `xml:"lang"`     // Book language
			Series   []struct {
				Name   string `xml:"name,attr"`
				Number int    `xml:"number,attr"`
			} `xml:"sequence"`
			CoverPage struct {
				Image struct {
					Href string `xml:"href,attr"`
				} `xml:"image"`
			} `xml:"coverpage"`
		} `xml:"title-info"`

		PublishInfo struct {
			Publisher string `xml:"publisher"` // Original (paper) book publisher
			City      string `xml:"city"`      // City where the original (paper) book was published
			Year      int    `xml:"year"`      // Year of the original (paper) publication
			ISBN      string `xml:"isbn"`      // ISBN
			Series    []struct {
				Name   string `xml:"name,attr"`
				Number int    `xml:"number,attr"`
			} `xml:"sequence"`
		} `xml:"publish-info"`
	} `xml:"description"`
}

func NewFB2

func NewFB2(rc io.ReadCloser) (*FB2, error)

func (*FB2) GetAuthors

func (fb *FB2) GetAuthors() []*model.Author

func (*FB2) GetCover

func (fb *FB2) GetCover() string

func (*FB2) GetFormat

func (fb *FB2) GetFormat() string

func (*FB2) GetGenres

func (fb *FB2) GetGenres() []string

func (*FB2) GetKeywords added in v1.0.0

func (fb *FB2) GetKeywords() string

func (*FB2) GetLanguage

func (fb *FB2) GetLanguage() *model.Language

func (*FB2) GetPlot

func (fb *FB2) GetPlot() string

func (*FB2) GetSerie

func (fb *FB2) GetSerie() *model.Serie

func (*FB2) GetSerieNumber

func (fb *FB2) GetSerieNumber() int

func (*FB2) GetSort

func (fb *FB2) GetSort() string

func (*FB2) GetTitle

func (fb *FB2) GetTitle() string

func (*FB2) GetYear

func (fb *FB2) GetYear() string

func (*FB2) String

func (fb *FB2) String() string

Jump to

Keyboard shortcuts

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