Documentation
¶
Index ¶
- func FindChapterIndexByTitle(r Reader, title string) int
- func RestoreFromAnchor(r Reader, anchor ProgressAnchor)
- type EpubReader
- func (epub *EpubReader) BookTitle() string
- func (r *EpubReader) Current() string
- func (epub *EpubReader) CurrentChapterIndex() int
- func (epub *EpubReader) CurrentChapterTitle() string
- func (r *EpubReader) CurrentPos() int
- func (r *EpubReader) CurrentView(lines int) string
- func (r *EpubReader) First() string
- func (epub *EpubReader) GetProgress() string
- func (epub *EpubReader) GetTOC() string
- func (epub *EpubReader) GetTOCWithSelection(selected, pageSize int) string
- func (r *EpubReader) Goto(pos int) string
- func (epub *EpubReader) GotoChapter(index int) string
- func (r *EpubReader) Last() string
- func (epub *EpubReader) Load(filePath string) error
- func (r *EpubReader) Next() string
- func (epub *EpubReader) NextChapter() string
- func (r *EpubReader) Prev() string
- func (epub *EpubReader) PrevChapter() string
- func (epub *EpubReader) Reflow(width int)
- func (r *EpubReader) Search(query string, start int, forward bool) (int, bool)
- func (r *EpubReader) Total() int
- type OnlineReader
- func (r *OnlineReader) BookTitle() string
- func (r *OnlineReader) ChapterOffset() float64
- func (r *OnlineReader) ChapterTitle(index int) string
- func (r *OnlineReader) Current() string
- func (r *OnlineReader) CurrentChapterIndex() int
- func (r *OnlineReader) CurrentChapterTitle() string
- func (r *OnlineReader) CurrentPos() int
- func (r *OnlineReader) CurrentView(lines int) string
- func (r *OnlineReader) First() string
- func (r *OnlineReader) GetProgress() string
- func (r *OnlineReader) GetTOC() string
- func (r *OnlineReader) GetTOCWithSelection(selected, pageSize int) string
- func (r *OnlineReader) Goto(pos int) string
- func (r *OnlineReader) GotoChapter(index int) string
- func (r *OnlineReader) Last() string
- func (r *OnlineReader) Load(string) error
- func (r *OnlineReader) Next() string
- func (r *OnlineReader) NextChapter() string
- func (r *OnlineReader) OverallProgress() float64
- func (r *OnlineReader) Prev() string
- func (r *OnlineReader) PrevChapter() string
- func (r *OnlineReader) Reflow(width int)
- func (r *OnlineReader) RestoreOffset(offset float64)
- func (r *OnlineReader) Search(query string, start int, forward bool) (int, bool)
- func (r *OnlineReader) SetDisplayTitles(titles []string)
- func (r *OnlineReader) Total() int
- type ProgressAnchor
- type Reader
- type Snapshot
- type TxtReader
- func (txt *TxtReader) BookTitle() string
- func (r *TxtReader) Current() string
- func (txt *TxtReader) CurrentChapterIndex() int
- func (txt *TxtReader) CurrentChapterTitle() string
- func (r *TxtReader) CurrentPos() int
- func (r *TxtReader) CurrentView(lines int) string
- func (r *TxtReader) First() string
- func (r *TxtReader) GetProgress() string
- func (txt *TxtReader) GetTOC() string
- func (txt *TxtReader) GetTOCWithSelection(selected, pageSize int) string
- func (r *TxtReader) Goto(pos int) string
- func (txt *TxtReader) GotoChapter(index int) string
- func (r *TxtReader) Last() string
- func (txt *TxtReader) Load(path string) error
- func (r *TxtReader) Next() string
- func (txt *TxtReader) NextChapter() string
- func (r *TxtReader) Prev() string
- func (txt *TxtReader) PrevChapter() string
- func (txt *TxtReader) Reflow(width int)
- func (r *TxtReader) Search(query string, start int, forward bool) (int, bool)
- func (r *TxtReader) Total() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindChapterIndexByTitle ¶
func RestoreFromAnchor ¶
func RestoreFromAnchor(r Reader, anchor ProgressAnchor)
Types ¶
type EpubReader ¶
type EpubReader struct {
// contains filtered or unexported fields
}
func NewEpubReader ¶
func NewEpubReader() *EpubReader
func (*EpubReader) BookTitle ¶
func (epub *EpubReader) BookTitle() string
func (*EpubReader) CurrentChapterIndex ¶
func (epub *EpubReader) CurrentChapterIndex() int
func (*EpubReader) CurrentChapterTitle ¶
func (epub *EpubReader) CurrentChapterTitle() string
func (*EpubReader) CurrentPos ¶
func (r *EpubReader) CurrentPos() int
func (*EpubReader) CurrentView ¶
func (*EpubReader) GetProgress ¶
func (epub *EpubReader) GetProgress() string
func (*EpubReader) GetTOC ¶
func (epub *EpubReader) GetTOC() string
func (*EpubReader) GetTOCWithSelection ¶
func (epub *EpubReader) GetTOCWithSelection(selected, pageSize int) string
func (*EpubReader) GotoChapter ¶
func (epub *EpubReader) GotoChapter(index int) string
func (*EpubReader) Load ¶
func (epub *EpubReader) Load(filePath string) error
func (*EpubReader) NextChapter ¶
func (epub *EpubReader) NextChapter() string
func (*EpubReader) PrevChapter ¶
func (epub *EpubReader) PrevChapter() string
func (*EpubReader) Reflow ¶
func (epub *EpubReader) Reflow(width int)
type OnlineReader ¶ added in v0.4.0
type OnlineReader struct {
Book booksource.Book
Chapters []booksource.Chapter
Index int
// contains filtered or unexported fields
}
OnlineReader holds one downloaded chapter. Networking is performed by the UI controller, outside the render/input loop, before installing a new chapter.
func NewOnlineReader ¶ added in v0.4.0
func NewOnlineReader(book booksource.Book, chapters []booksource.Chapter, index int, text string) *OnlineReader
func (*OnlineReader) BookTitle ¶ added in v0.4.0
func (r *OnlineReader) BookTitle() string
func (*OnlineReader) ChapterOffset ¶ added in v0.4.0
func (r *OnlineReader) ChapterOffset() float64
func (*OnlineReader) ChapterTitle ¶ added in v0.4.0
func (r *OnlineReader) ChapterTitle(index int) string
func (*OnlineReader) CurrentChapterIndex ¶ added in v0.4.0
func (r *OnlineReader) CurrentChapterIndex() int
func (*OnlineReader) CurrentChapterTitle ¶ added in v0.4.0
func (r *OnlineReader) CurrentChapterTitle() string
func (*OnlineReader) CurrentPos ¶ added in v0.4.0
func (r *OnlineReader) CurrentPos() int
func (*OnlineReader) CurrentView ¶ added in v0.4.0
func (*OnlineReader) GetProgress ¶ added in v0.4.0
func (r *OnlineReader) GetProgress() string
func (*OnlineReader) GetTOC ¶ added in v0.4.0
func (r *OnlineReader) GetTOC() string
func (*OnlineReader) GetTOCWithSelection ¶ added in v0.4.0
func (r *OnlineReader) GetTOCWithSelection(selected, pageSize int) string
func (*OnlineReader) GotoChapter ¶ added in v0.4.0
func (*OnlineReader) Load ¶ added in v0.4.0
func (r *OnlineReader) Load(string) error
func (*OnlineReader) NextChapter ¶ added in v0.4.0
func (r *OnlineReader) NextChapter() string
func (*OnlineReader) OverallProgress ¶ added in v0.4.0
func (r *OnlineReader) OverallProgress() float64
Progress is based on chapter index plus progress within the current chapter.
func (*OnlineReader) PrevChapter ¶ added in v0.4.0
func (r *OnlineReader) PrevChapter() string
func (*OnlineReader) RestoreOffset ¶ added in v0.4.0
func (r *OnlineReader) RestoreOffset(offset float64)
func (*OnlineReader) SetDisplayTitles ¶ added in v0.4.0
func (r *OnlineReader) SetDisplayTitles(titles []string)
Display titles can be purified without altering the source metadata used for requests, matching, and the original chapter cache.
type ProgressAnchor ¶
func AnchorFromReader ¶
func AnchorFromReader(r Reader) ProgressAnchor
type Reader ¶
type Reader interface {
Load(path string) error
Reflow(width int)
BookTitle() string
Current() string
CurrentView(lines int) string
Total() int
Search(query string, start int, forward bool) (int, bool)
Next() string
Prev() string
First() string
Last() string
CurrentPos() int
Goto(pos int) string
GetProgress() string
CurrentChapterTitle() string
CurrentChapterIndex() int
NextChapter() string
PrevChapter() string
GetTOC() string
GetTOCWithSelection(selected, pageSize int) string
GotoChapter(index int) string
}
type Snapshot ¶
type Snapshot struct {
Kind string `json:"kind"`
Title string `json:"title,omitempty"`
RawText string `json:"raw_text,omitempty"`
ChapterText []string `json:"chapter_text,omitempty"`
ChapterTitles []string `json:"chapter_titles,omitempty"`
}
func SnapshotFromReader ¶
type TxtReader ¶
type TxtReader struct {
// contains filtered or unexported fields
}
func NewTxtReader ¶
func NewTxtReader() *TxtReader
func (*TxtReader) CurrentChapterIndex ¶
func (*TxtReader) CurrentChapterTitle ¶
func (*TxtReader) CurrentPos ¶
func (r *TxtReader) CurrentPos() int
func (*TxtReader) CurrentView ¶
func (*TxtReader) GetProgress ¶
func (r *TxtReader) GetProgress() string
func (*TxtReader) GetTOCWithSelection ¶
func (*TxtReader) GotoChapter ¶
func (*TxtReader) NextChapter ¶
func (*TxtReader) PrevChapter ¶
Click to show internal directories.
Click to hide internal directories.