manga

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChapterZeroValue = -1
	VolumeZeroValue  = -1
	AuthorZeroValue  = ""
	TitleZeroValue   = ""
)
View Source
const (
	DefaultMaxWidth  = 300
	DefaultMaxHeight = 300
)

Variables

View Source
var (
	ErrCoverNotExist       = errors.New("cover does not exist")
	ErrArchiveFileNotFound = errors.New("file not found in archive")
)
View Source
var (
	TimeZeroValue = time.Time{}
)

Functions

This section is empty.

Types

type Archive

type Archive struct {
	Title   string       `json:"title"`    // Title of the archive (filename without the extension)
	Path    string       `json:"path"`     // Path to the archive on the filesystem
	Type    archive.Type `json:"type"`     // What file format is the archive e.g. zip/rar
	Cover   *Cover       `json:"cover"`    // Link to the embedded cover in the archive
	ModTime time.Time    `json:"mod_time"` // Modified time of the archive
}

func UnmarshalArchive

func UnmarshalArchive(data []byte) *Archive

func (*Archive) CoverFile

func (a *Archive) CoverFile() ([]byte, error)

func (*Archive) Exists

func (a *Archive) Exists() bool

func (*Archive) FilenameWithExt

func (a *Archive) FilenameWithExt() string

func (*Archive) Filesize

func (a *Archive) Filesize() float64

Filesize returns the archives filesize in MiB

func (*Archive) ReaderForFile

func (a *Archive) ReaderForFile(fp string) (io.Reader, int64, error)

func (*Archive) ThumbnailFile

func (a *Archive) ThumbnailFile() ([]byte, error)

func (*Archive) Walk

func (a *Archive) Walk(f func(f archiver.File) error) error

type Cover

type Cover struct {
	Fp        string     `json:"file"`       // Filepath
	ImageType image.Type `json:"image_type"` // What type is the image, e.g. PNG, JPEG, ...
}

Cover is a filepath to an image file which represents the cover of the manga entry

func UnmarshalCover

func UnmarshalCover(data []byte) *Cover

func (*Cover) ExistsOnFS

func (c *Cover) ExistsOnFS() bool

func (*Cover) ReadFile

func (c *Cover) ReadFile() ([]byte, error)

func (*Cover) ThumbnailFile

func (c *Cover) ThumbnailFile() ([]byte, error)

type EntryMetadata

type EntryMetadata struct {
	Title        string     `json:"title"`
	Chapter      int        `json:"chapter"`
	Volume       int        `json:"volume"`
	Author       string     `json:"author"`
	DateReleased *date.Date `json:"date_released"`
}

func NewEntryMetadata

func NewEntryMetadata() *EntryMetadata

func UnmarshalEntryMetadata

func UnmarshalEntryMetadata(data []byte) *EntryMetadata

type Page

type Page struct {
	ImageType image.Type `json:"image_type"` // Image encoding e.g. ".png"
	Path      string     `json:"path"`       // Path to the file in the archive
}

func UnmarshalPage

func UnmarshalPage(data []byte) *Page

type ParsedEntry

type ParsedEntry struct {
	Order    int            // 1-indexed order
	Archive  *Archive       // EntriesMetadata about the manga archive file
	Metadata *EntryMetadata // Metadata of the manga
	Pages    []*Page        // Pages of the manga
}

ParsedEntry represents an entry which you read, i.e. an archive file

func ParseArchive

func ParseArchive(fp string) (*ParsedEntry, error)

type ParsedSeries

type ParsedSeries struct {
	Title   string         // Title of the ParsedSeries
	Entries []*ParsedEntry // Slice of all entries in the series
}

ParsedSeries is a collection of ParsedEntry volumes/chapters

func ParseSeriesFolder

func ParseSeriesFolder(dir string) (*ParsedSeries, error)

type SeriesMetadata

type SeriesMetadata struct {
	Title        string     `json:"title"`
	Author       string     `json:"author"`
	DateReleased *date.Date `json:"date_released"`
}

func UnmarshalSeriesMetadata

func UnmarshalSeriesMetadata(data []byte) *SeriesMetadata

Jump to

Keyboard shortcuts

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