Documentation
¶
Overview ¶
Package aozorafs provides functionality for browsing the database of Aozora Bunko by exposing the contents of the library as an fs.FS.
Index ¶
- func SetDownloader(f func(path string) []byte)
- type ContribRole
- type LibFS
- type LibFile
- type Library
- func (lib *Library) BookList() []*Record
- func (lib *Library) FetchLibrary()
- func (lib *Library) FindBooksWithMatchingCategories(q string) (categories []*Record)
- func (lib *Library) FindMatchingAuthors(q string) (authors []*Record)
- func (lib *Library) FindMatchingCategories(q string) (categories []string)
- func (lib *Library) FindMatchingTitles(q string) (titles []*Record)
- func (lib *Library) FirstBookBy(b *Record) *Record
- func (lib *Library) GenRandomBook() (fs.File, error)
- func (lib *Library) GenSearchResults(q string) []byte
- func (lib *Library) GetBookRecord(name string) (*Record, error)
- func (lib *Library) GetBooklist(d []byte)
- func (lib *Library) GetRecordWithID(authorid, bookid string) *Record
- func (lib *Library) ImportTemplates(dir fs.ReadDirFS)
- func (lib *Library) Initialize(src string, dir string, clean, verbose, kids, strict bool)
- func (lib *Library) LastBookBy(b *Record) *Record
- func (lib *Library) LenDistinctBooks() int
- func (lib *Library) NextAuthor(b *Record) *Record
- func (lib *Library) NextBook(b *Record) *Record
- func (lib *Library) Open(name string) (f fs.File, err error)
- func (lib *Library) PrevAuthor(b *Record) *Record
- func (lib *Library) PrevBook(b *Record) *Record
- func (lib *Library) RandomBook() *Record
- func (lib *Library) SetCache(fs LibFS)
- func (lib *Library) SetKids(k bool)
- func (lib *Library) SetSrc(name string)
- func (lib *Library) SortByAvailDate()
- type Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDownloader ¶ added in v0.9.0
Types ¶
type ContribRole ¶ added in v0.2.0
ContribRole is for storing various contributors to a book.
type Library ¶
Library is stores basic information. Root is the path to the original aozora file tree. Cache is path to the storage directory for server. Resources holds the templates, css. Catalog is for stroing Library information.
func (*Library) FetchLibrary ¶ added in v0.9.0
func (lib *Library) FetchLibrary()
func (*Library) FindBooksWithMatchingCategories ¶ added in v0.9.0
func (*Library) FindMatchingAuthors ¶ added in v0.3.0
FindMatchingAuthors finds the authors whose names include q.
func (*Library) FindMatchingCategories ¶ added in v0.3.0
FindMatchingCategories finds the books whose NDC category include q
func (*Library) FindMatchingTitles ¶ added in v0.3.0
FindMatchingTitles finds the books whose title+subtitle contain q.
func (*Library) FirstBookBy ¶ added in v0.9.0
func (*Library) GenRandomBook ¶ added in v0.9.0
func (*Library) GenSearchResults ¶ added in v0.9.0
func (*Library) GetBookRecord ¶ added in v0.9.0
func (*Library) GetBooklist ¶ added in v0.50.1
func (*Library) GetRecordWithID ¶ added in v0.9.0
func (*Library) ImportTemplates ¶ added in v0.9.0
func (*Library) Initialize ¶
Initialize initalized the library lib to the given specifications.
- dir is the root directory of the library on the local file system.
- clean specifies whether or not to start with an empty library directory.
- verbose toggles verbose logging to screen. Logging to aozora.log will always take place.
- kids specifies toggles children's library (removes books that are not marked as children's book in the Aozora Bunko database.
- strict toggles whether or not to include books that are not in the public domain.
- checkInt specifies the interval for checking for updates to the library upstream.
func (*Library) LastBookBy ¶ added in v0.9.0
func (*Library) LenDistinctBooks ¶ added in v0.50.1
func (*Library) NextAuthor ¶
NextAuthor returns the next author where the current author is the author of b.
func (*Library) PrevAuthor ¶
PrevAuthor returns the previous author where the current author is the author of b.
func (*Library) RandomBook ¶ added in v0.9.0
func (*Library) SortByAvailDate ¶ added in v0.50.1
func (lib *Library) SortByAvailDate()
type Record ¶
type Record struct {
BookID string
Title string
TitleY string
TitleSort string
Subtitle string
SubtitleY string
SubtitleSort string
OriginalTitle string
PublDate string
NDC string
Category string
Categories [][3]string
KanaZukai string
WorkCopyright string
FirstAvailable string
ModTime string
AuthorID string
NameSei string
NameMei string
NameSeiY string
NameMeiY string
NameSeiSort string
NameMeiSort string
NameSeiR string
NameMeiR string
Role string
DoBirth string
DoDeath string
AuthorCopyright string
URI string
Kids bool
Contributors []ContribRole
TxtFileName string
// contains filtered or unexported fields
}
Record is for storing information about individual books.
func (*Record) FullName ¶
FullName returns the full name in Japanese order (family name first), with a space between family and given name.
func (*Record) FullNameY ¶
FullNameY returns the yomi of full name. It return a blank when there is no kanji in the name.
func (*Record) RealBookID ¶
RealBookID returns the book id without any suffixes.
func (*Record) SetCategoryString ¶ added in v0.50.1
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package stringops provides some functionality to assist with working with strings.
|
Package stringops provides some functionality to assist with working with strings. |
|
Package zipfs provides some helper functions to help working with zip files.
|
Package zipfs provides some helper functions to help working with zip files. |