metadata

package
v3.14.5 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpubReader

type EpubReader struct{}

func (EpubReader) Cover

func (e EpubReader) Cover(documentFullPath string, coverMaxWidth int) ([]byte, error)

Cover parses the document looking for a cover image and returns it

func (EpubReader) Metadata

func (e EpubReader) Metadata(file string) (Metadata, error)

type Metadata

type Metadata struct {
	Title       string
	Authors     []string
	Description template.HTML
	Language    string
	Year        string
	Words       float64
	Cover       string
	Series      string
	SeriesIndex float64
	Pages       int
	Type        string
	Subjects    []string
}

func (Metadata) ReadingTime

func (m Metadata) ReadingTime(wordsPerMinute float64) string

type PdfReader

type PdfReader struct{}

func (PdfReader) Cover

func (p PdfReader) Cover(documentFullPath string, coverMaxWidth int) ([]byte, error)

Cover parses the document looking for a cover image and returns it

func (PdfReader) Metadata

func (p PdfReader) Metadata(file string) (Metadata, error)

type Reader

type Reader interface {
	Metadata(file string) (Metadata, error)
	Cover(documentFullPath string, coverMaxWidth int) ([]byte, error)
}

type ReaderMock

type ReaderMock struct {
	MetadataFake func(file string) (Metadata, error)
	CoverFake    func(documentFullPath string) ([]byte, error)
}

func NewReaderMock

func NewReaderMock() ReaderMock

func (ReaderMock) Cover

func (e ReaderMock) Cover(documentFullPath string, coverMaxWidth int) ([]byte, error)

func (ReaderMock) Metadata

func (e ReaderMock) Metadata(file string) (Metadata, error)

Jump to

Keyboard shortcuts

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