Documentation
¶
Overview ¶
Package epubparser provides functions for reading EPUB files and extracting basic metadata such as title, author, description and various tags. It is designed to be embedded in other applications (a CLI, a GUI, etc.) that need to index or display metadata from book files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractXmlFromZip ¶
Types ¶
type Book ¶
type Book struct {
Title string `json:"title"`
Metadata Metadata `json:"metadata"`
Path string `json:"path"`
}
func ScanDirectory ¶
ScanDirectory walks the given path and returns a slice of Book objects for every ".epub" file found directly inside. Subdirectories are ignored.
type Metadata ¶
type Metadata struct {
Title string `json:"title"`
Description string `json:"description"`
Creators string `json:"creators"`
Category string `json:"category"`
AgeRating string `json:"age_rating"`
ContentWarnings []string `json:"content_warnings"`
Fandoms []string `json:"fandoms"`
Characters []string `json:"characters"`
Relationships []string `json:"relationships"`
AdditionalTags []string `json:"additional_tags"`
}
func Parse ¶
Parse opens the EPUB file located at the supplied path, reads the embedded XML documents (in particular the package OPF and the first XHTML preface) and returns a Metadata struct populated with the information it finds. Any fatal errors during parsing will call log.Fatal; callers should normally validate the file before using this helper.