src

package
v0.0.0-...-bf18690 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitEpubFile

func InitEpubFile() *epub.Epub

func InputAccountToken

func InputAccountToken() bool

func LoginAccount

func LoginAccount(username string, password string)

func NewChoiceBookshelf

func NewChoiceBookshelf() (map[string]string, error)

Types

type Catalogue

type Catalogue struct {
	ChapterBar  *ProgressBar
	ChapterCfg  []string
	EpubSetting *epub.Epub
}

func BookDetailed

func BookDetailed() *Catalogue

func SettingBooks

func SettingBooks(bookId string) (*Catalogue, error)

func (*Catalogue) DownloadContent

func (catalogue *Catalogue) DownloadContent(threading *threading.GoLimit, chapterID string)

func (*Catalogue) GetDownloadsList

func (catalogue *Catalogue) GetDownloadsList() ([]string, error)

func (*Catalogue) MergeTextAndEpubFiles

func (catalogue *Catalogue) MergeTextAndEpubFiles()

func (*Catalogue) ReadChapterConfig

func (catalogue *Catalogue) ReadChapterConfig()

type Option

type Option func(p *ProgressBar)

Option is the type all options need to adhere to

type ProgressBar

type ProgressBar struct {
	// contains filtered or unexported fields
}

ProgressBar is a thread-safe, simple progress bar

func New

func New(max int) *ProgressBar

New returns a new ProgressBar with the specified maximum

func NewOptions

func NewOptions(max int, options ...Option) *ProgressBar

NewOptions constructs a new instance of ProgressBar, with any options you specify

func NewOptions64

func NewOptions64(max int64, options ...Option) *ProgressBar

NewOptions64 constructs a new instance of ProgressBar, with any options you specify

func (*ProgressBar) Add

func (p *ProgressBar) Add(num int) error

Add will add the specified amount to the progressbar

func (*ProgressBar) Add64

func (p *ProgressBar) Add64(num int64) error

Add64 will add the specified amount to the progressbar

func (*ProgressBar) ChangeMax

func (p *ProgressBar) ChangeMax(newMax int)

ChangeMax takes in int and changes the max value of the progress bar

func (*ProgressBar) ChangeMax64

func (p *ProgressBar) ChangeMax64(newMax int64)

ChangeMax64 is basically the same as ChangeMax, but takes in int64 to avoid casting

func (*ProgressBar) Clear

func (p *ProgressBar) Clear() error

Clear erases the progress bar from the current line

func (*ProgressBar) Close

func (p *ProgressBar) Close() (err error)

func (*ProgressBar) Describe

func (p *ProgressBar) Describe(description string)

Describe will change the description shown before the progress, which can be changed on the fly (as for a slow running process).

func (*ProgressBar) Finish

func (p *ProgressBar) Finish() error

Finish will fill the bar to full

func (*ProgressBar) GetMax

func (p *ProgressBar) GetMax() int

GetMax returns the max of a bar

func (*ProgressBar) GetMax64

func (p *ProgressBar) GetMax64() int64

GetMax64 returns the current max

func (*ProgressBar) IsFinished

func (p *ProgressBar) IsFinished() bool

IsFinished returns true if progress bar is completed

func (*ProgressBar) Read

func (p *ProgressBar) Read(b []byte) (n int, err error)

Read implement io.Reader

func (*ProgressBar) RenderBlank

func (p *ProgressBar) RenderBlank() error

RenderBlank renders the current bar state, you can use this to render a 0% state

func (*ProgressBar) Reset

func (p *ProgressBar) Reset()

Reset will reset the clock that is used to calculate current time and the time left.

func (*ProgressBar) Set

func (p *ProgressBar) Set(num int) error

Set wil set the bar to a current number

func (*ProgressBar) Set64

func (p *ProgressBar) Set64(num int64) error

Set64 wil set the bar to a current number

func (*ProgressBar) State

func (p *ProgressBar) State() State

State returns the current state

func (*ProgressBar) String

func (p *ProgressBar) String() string

String returns the current rendered version of the progress bar. It will never return an empty string while the progress bar is running.

func (*ProgressBar) Write

func (p *ProgressBar) Write(b []byte) (n int, err error)

Write implement io.Writer

type Reader

type Reader struct {
	io.Reader
	// contains filtered or unexported fields
}

Reader is the progressbar io.Reader struct

func (*Reader) Close

func (r *Reader) Close() (err error)

Close the reader when it implements io.Closer

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read will read the data and add the number of bytes to the progressbar

type Search struct {
	Keyword      string
	Page         int
	SearchResult []string
}

func (*Search) CatSearchDetailed

func (s *Search) CatSearchDetailed() []string

func (*Search) SearchBook

func (s *Search) SearchBook() string

func (*Search) SfacgSearchDetailed

func (s *Search) SfacgSearchDetailed() []string

type State

type State struct {
	CurrentPercent float64
	CurrentBytes   float64
	SecondsSince   float64
	SecondsLeft    float64
	KBsPerSecond   float64
}

State is the basic properties of the bar

type Theme

type Theme struct {
	Saucer        string
	AltSaucerHead string
	SaucerHead    string
	SaucerPadding string
	BarStart      string
	BarEnd        string
}

Theme defines the elements of the bar

Jump to

Keyboard shortcuts

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