Documentation
¶
Index ¶
- func BuildAudiobookTracks(destPath string) ([]domain.Track, int, error)
- func ContainsAudioFiles(dirPath string) bool
- func ExtractEpubAsset(filePath string, assetPath string) ([]byte, error)
- func ExtractMobiTextPreview(filePath string, maxChars int) (string, error)
- func ExtractTextPreview(filePath string, maxChars int) (string, error)
- func InferEditionType(filePath string) string
- func InferFormat(filePath string) string
- func IsAudioExt(path string) bool
- func IsImportableExt(path string) bool
- type Extracted
- type ImportInput
- type ImportResult
- type Importer
- type MatchResult
- type Matcher
- type ReaderChapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAudiobookTracks ¶
BuildAudiobookTracks enumerates audio files and creates a track list.
func ContainsAudioFiles ¶
ContainsAudioFiles returns true if the directory contains audio files.
func ExtractEpubAsset ¶
ExtractEpubAsset returns raw bytes for an asset within an EPUB.
func ExtractMobiTextPreview ¶
ExtractMobiTextPreview returns a plain-text preview of MOBI content.
func ExtractTextPreview ¶
ExtractTextPreview returns a plain-text preview of a book's content.
func InferEditionType ¶
InferEditionType determines the edition type from a file path.
func InferFormat ¶
InferFormat determines the format string from a file path.
func IsAudioExt ¶
IsAudioExt returns true if the file extension is a supported audio format.
func IsImportableExt ¶
IsImportableExt returns true if the file extension is importable.
Types ¶
type Extracted ¶
type Extracted struct {
Title string
Authors []string
Series string
SeriesIndex float64
ISBN string
PublishedYear int
Language string
Publisher string
Description string
Subjects []string // genre/category tags
Format string // "epub", "mobi", "mp3", "m4b", "pdf"
CoverData []byte
CoverExt string // ".jpg", ".png", etc.
}
Extracted holds metadata extracted from a book file.
func ExtractAudioMetadata ¶
ExtractAudioMetadata extracts metadata from an audio file or directory.
func ExtractEpubMetadata ¶
ExtractEpubMetadata extracts metadata and cover from an EPUB file.
func ExtractMobiMetadata ¶
ExtractMobiMetadata extracts metadata and cover from a MOBI file.
type ImportInput ¶
type ImportInput struct {
SourcePath string
LibraryID int64
Title string
Authors []string
Series string
SeriesIndex *float64
}
ImportInput specifies what to import.
type ImportResult ¶
type ImportResult struct {
Work *domain.Work
Edition *domain.Edition
IsNew bool
Skipped bool
SkipReason string
}
ImportResult describes the outcome of an import.
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
Importer orchestrates the full import pipeline.
func NewImporter ¶
NewImporter creates a new Importer.
func (*Importer) BulkImport ¶
func (imp *Importer) BulkImport(dirPath string, libraryID int64) ([]ImportResult, error)
BulkImport imports all supported files from a directory.
func (*Importer) Import ¶
func (imp *Importer) Import(input ImportInput) (*ImportResult, error)
Import imports a single file or directory.
type MatchResult ¶
type MatchResult struct {
Work *domain.Work
Authors []domain.Author
Series *domain.Series
IsNewWork bool
IsDuplicate bool
DuplicateEditionID int64
}
MatchResult contains the results of matching extracted metadata against the store.
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher matches extracted metadata to existing or new entities in the store.
type ReaderChapter ¶
ReaderChapter describes a chapter in an EPUB for the reader.
func ExtractEpubChapter ¶
ExtractEpubChapter returns chapter HTML, the chapter file path within the EPUB, and the full chapter list.
func ExtractEpubChapterText ¶
func ExtractEpubChapterText(filePath string, index int) (string, []ReaderChapter, error)
ExtractEpubChapterText returns plain text for an EPUB chapter.