epub

package
v0.0.0-...-4a954cd Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	Src       string `xml:"src,attr"`
	ClipBegin string `xml:"clipBegin,attr"`
	ClipEnd   string `xml:"clipEnd,attr"`
}

type Author

type Author struct {
	Data   string `xml:",chardata"`
	FileAs string `xml:"file-as,attr"`
	Role   string `xml:"role,attr"`
	ID     string `xml:"id,attr"`
}

Author author

type Body

type Body struct {
	TextRef string `xml:"textref,attr"`
	Seq     []Seq  `xml:"seq"`
	Par     []Par  `xml:"par"`
}

type CipherData

type CipherData struct {
	CipherReference CipherReference `xml:"CipherReference"`
}

type CipherReference

type CipherReference struct {
	URI string `xml:"URI,attr"`
}

type Compression

type Compression struct {
	Method         string `xml:"Method,attr"`
	OriginalLength string `xml:"OriginalLength,attr"`
}

type Container

type Container struct {
	Rootfile Rootfile `xml:"rootfiles>rootfile"`
}

Container META-INF/container.xml file

type Content

type Content struct {
	Src string `xml:"src,attr"`
}

Content nav-point content

type Date

type Date struct {
	Data  string `xml:",chardata"`
	Event string `xml:"event,attr"`
}

Date date

type EncryptedData

type EncryptedData struct {
	EncryptionMethod     EncryptionMethod     `xml:"EncryptionMethod"`
	KeyInfo              KeyInfo              `xml:"KeyInfo"`
	CipherData           CipherData           `xml:"CipherData"`
	EncryptionProperties []EncryptionProperty `xml:"EncryptionProperties>EncryptionProperty"`
}

type Encryption

type Encryption struct {
	EncryptedData []EncryptedData `xml:"EncryptedData"`
}

Encryption encruption.xml

type EncryptionMethod

type EncryptionMethod struct {
	Algorithm string `xml:"Algorithm,attr"`
}

type EncryptionProperty

type EncryptionProperty struct {
	Compression Compression `xml:"Compression"`
}

type Epub

type Epub struct {
	Ncx        Ncx
	NcxPath    string
	Opf        Opf
	Container  Container
	Encryption Encryption
	LCP        LCP
	// contains filtered or unexported fields
}

Epub represent epub data

func OpenDir

func OpenDir(filename string) (*Epub, error)

OpenDir open a opf file

func OpenEpub

func OpenEpub(fn string) (*Epub, error)

OpenEpub open and parse epub

func (*Epub) Close

func (epub *Epub) Close()

Close close file reader

func (*Epub) GetData

func (epub *Epub) GetData(filename string) ([]byte, error)

GetData return raw data from file

func (*Epub) GetSMIL

func (epub *Epub) GetSMIL(ressource string) SMIL

GetSMIL parse and return SMIL structure

func (*Epub) Open

func (epub *Epub) Open(filepath string) (io.ReadCloser, error)

Open open resource file

func (*Epub) RawOpen

func (epub *Epub) RawOpen(filepath string) (io.ReadCloser, error)

RawOpen open resource file without filepath transform

func (*Epub) ZipReader

func (epub *Epub) ZipReader() *zip.ReadCloser

ZipReader return the internal file descriptor

type Identifier

type Identifier struct {
	Data   string `xml:",chardata"`
	ID     string `xml:"id,attr"`
	Scheme string `xml:"scheme,attr"`
}

Identifier identifier

type KeyInfo

type KeyInfo struct {
	Resource        string          `xml:",chardata"`
	RetrievalMethod RetrievalMethod `xml:"RetrievalMethod"`
}

type LCP

type LCP struct {
	ID         string     `json:"id"`
	Issued     *time.Time `json:"issued"`
	Provider   string     `json:"provider"`
	Updated    *time.Time `json:"updated,omitempty"`
	Encryption struct {
		Profile    string `json:"profile"`
		ContentKey struct {
			EncryptedValue string `json:"encrypted_value"`
			Algorithm      string `json:"algorithm"`
		} `json:"content_key"`
		UserKey struct {
			TextHint  string `json:"text_hint"`
			Algorithm string `json:"algorithm"`
			KeyCheck  string `json:"key_check"`
		} `json:"user_key"`
	} `json:"encryption"`
	Links []struct {
		Rel       string `json:"rel"`
		Href      string `json:"href"`
		Title     string `json:"title"`
		Type      string `json:"type"`
		Templated string `json:"templated"`
		Profile   string `json:"profile"`
		Length    int    `json:"length"`
		Hash      string `json:"hash"`
	} `json:"links"`
	Rights struct {
		Print int        `json:"print"`
		Copy  int        `json:"copy"`
		Start *time.Time `json:"start"`
		End   *time.Time `json:"end"`
	} `json:"rights"`
	User struct {
		ID        string   `json:"id"`
		Email     string   `json:"email"`
		Name      string   `json:"name"`
		Encrypted []string `json:"encrypted"`
	} `json:"user"`
	Signature struct {
		Algorithm   string `json:"algorithm"`
		Certificate string `json:"certificate"`
		Value       string `json:"value"`
	} `json:"signature"`
}

LCP struct for the lcp license

type Manifest

type Manifest struct {
	ID           string `xml:"id,attr"`
	Href         string `xml:"href,attr"`
	MediaType    string `xml:"media-type,attr"`
	Fallback     string `xml:"media-fallback,attr"`
	Properties   string `xml:"properties,attr"`
	MediaOverlay string `xml:"media-overlay,attr"`
}

Manifest manifest

type Metadata

type Metadata struct {
	Title       []Title      `xml:"title"`
	Language    []string     `xml:"language"`
	Identifier  []Identifier `xml:"identifier"`
	Creator     []Author     `xml:"creator"`
	Subject     []Subject    `xml:"subject"`
	Description []string     `xml:"description"`
	Publisher   []string     `xml:"publisher"`
	Contributor []Author     `xml:"contributor"`
	Date        []Date       `xml:"date"`
	Type        []string     `xml:"type"`
	Format      []string     `xml:"format"`
	Source      []string     `xml:"source"`
	Relation    []string     `xml:"relation"`
	Coverage    []string     `xml:"coverage"`
	Rights      []string     `xml:"rights"`
	Meta        []Metafield  `xml:"meta"`
}

Metadata metadata

type Metafield

type Metafield struct {
	Name     string `xml:"name,attr"`
	Content  string `xml:"content,attr"`
	Refine   string `xml:"refines,attr"`
	Property string `xml:"property,attr"`
	Data     string `xml:",chardata"`
	ID       string `xml:"id,attr"`
	Lang     string `xml:"lang,attr"`
}

Metafield metafield

type NavPoint struct {
	ID          string     `xml:"id,attr"`
	Text        string     `xml:"navLabel>text"`
	Content     Content    `xml:"content"`
	Points      []NavPoint `xml:"navPoint"`
	PlayerOrder int        `xml:"playOrder,attr"`
}

NavPoint nav point

type Ncx

type Ncx struct {
	Points   []NavPoint `xml:"navMap>navPoint"`
	PageList PageList   `xml:"pageList"`
}

Ncx OPS/toc.ncx

type Opf

type Opf struct {
	Metadata         Metadata    `xml:"metadata"`
	Manifest         []Manifest  `xml:"manifest>item"`
	Spine            Spine       `xml:"spine"`
	Guide            []Reference `xml:"guide>reference"`
	UniqueIdentifier string      `xml:"unique-identifier,attr"`
	Dir              string      `xml:"dir,attr"`
	Version          string      `xml:"version,attr"`
}

Opf content.opf

type PageList

type PageList struct {
	PageTarget []PageTarget `xml:"pageTarget"`
	Class      string       `xml:"class,attr"`
	ID         string       `xml:"id,attr"`
}

PageList page list

type PageTarget

type PageTarget struct {
	ID        string  `xml:"id,attr"`
	Text      string  `xml:"navLabel>text"`
	Value     string  `xml:"value,attr"`
	Type      string  `xml:"type,attr"`
	PlayOrder int     `xml:"playOrder,attr"`
	Content   Content `xml:"content"`
}

PageTarget page target

type Par

type Par struct {
	Text  Text  `xml:"text"`
	Audio Audio `xml:"audio"`
}

type Reference

type Reference struct {
	Href  string `xml:"href,attr"`
	Title string `xml:"title,attr"`
	Type  string `xml:"type,attr"`
}

Reference reference in guide

type RetrievalMethod

type RetrievalMethod struct {
	URI  string `xml:"URI,attr"`
	Type string `xml:"Type,attr"`
}

type Rootfile

type Rootfile struct {
	Path    string `xml:"full-path,attr"`
	Type    string `xml:"media-type,attr"`
	Version string `xml:"version,attr"`
}

Rootfile root file

type SMIL

type SMIL struct {
	Body Body `xml:"body"`
}

type Seq

type Seq struct {
	TextRef string `xml:"textref,attr"`
	Par     []Par  `xml:"par"`
	Seq     []Seq  `xml:"seq"`
}

type Spine

type Spine struct {
	ID              string      `xml:"id,attr"`
	Toc             string      `xml:"toc,attr"`
	PageProgression string      `xml:"page-progression-direction,attr"`
	Items           []SpineItem `xml:"itemref"`
}

Spine spine

type SpineItem

type SpineItem struct {
	IDref      string `xml:"idref,attr"`
	Linear     string `xml:"linear,attr"`
	ID         string `xml:"id,attr"`
	Properties string `xml:"properties,attr"`
}

SpineItem spine item

type Subject

type Subject struct {
	Data      string `xml:",chardata"`
	Term      string `xml:"term,attr"`
	Authority string `xml:"authority,attr"`
	Lang      string `xml:"lang,attr"`
}

Subject subject

type Text

type Text struct {
	Src string `xml:"src,attr"`
}

type Title

type Title struct {
	Data string `xml:",chardata"`
	ID   string `xml:"id,attr"`
	Lang string `xml:"lang,attr"`
	Dir  string `xml:"dir,attr"`
}

Title title

Jump to

Keyboard shortcuts

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