Documentation ¶
Index ¶
- Constants
- func Bind(config Config, book Book) error
- func Combine(config Config) error
- func OutputFilePattern(book Book, pathPattern string) string
- func OutputPathPattern(book Book, pathPattern string) (string, error)
- func ParsePathTags(path, pathPattern string) (map[string]string, error)
- func SplitSingleFile(config *Config) error
- func TranscodeSourceFiles(config *Config) error
- type Book
- func (b *Book) CalcChapterTimes()
- func (b *Book) ChapterByFile(config Config, useFileNames, useTagTitle bool) error
- func (b *Book) ExtractChapters(config Config) error
- func (b *Book) GenerateMetaTemplate(config Config) error
- func (b *Book) GenerateStaticChapters(config Config, chapterLengthMin int) error
- func (b *Book) ParseFromPattern(tags map[string]string)
- func (b *Book) ParseToChapters(config Config) error
- func (b *Book) WriteTags(filename string) error
- type Chapter
- type Config
- type TrackFile
Constants ¶
const ( Aac = ".aac" Flac = ".flac" Mp4 = ".mp4" M4a = ".m4a" M4b = ".m4b" Mp3 = ".mp3" Ogg = ".ogg" Opus = ".opus" )
const ( AudioFile = "%f" Author = "%a" Genre = "%g" Narrator = "%n" ReleaseDate = "%y" Series = "%s" SeriesPart = "%p" Title = "%t" )
path templates
const ( AuthorGrok = "%{GREEDYDATA:author}" AudioFileGrok = "%{AUDIO_FILE:audio_file}" GenreGrok = "%{GREEDYDATA:genre}" NarratorGrok = "%{GREEDYDATA:narrator}" ReleaseDateGrok = "%{NUMBER:release_date}" SeriesGrok = "%{GREEDYDATA:series}" SeriesPartGrok = "%{NUMBER:series_part}" TitleGrok = "%{GREEDYDATA:title}" )
pattern Groks
Variables ¶
This section is empty.
Functions ¶
func OutputFilePattern ¶
OutputFilePattern renders filename based on path pattern and Book data
func OutputPathPattern ¶
OutputPathPattern renders directory structure based on path pattern and Book data
func ParsePathTags ¶
ParsePathTags takes in file path and pattern string returning a map of the pattern matched values
func SplitSingleFile ¶
SplitSingleFile splits single file into chunks for later transcoding
func TranscodeSourceFiles ¶
TranscodeSourceFiles runs concurrent transcode of source media into mp4 audio files for combination later
Types ¶
type Book ¶
type Book struct { Author string Chapters []*Chapter Date *string Description *string Genre *string Narrator *string SortSlug *string Title string // contains filtered or unexported fields }
Book top level construct of book
func (*Book) CalcChapterTimes ¶
func (b *Book) CalcChapterTimes()
CalcChapterTimes calculates the duration of the chapter
func (*Book) ChapterByFile ¶
ChapterByFile creates Chapter objects from individual files
func (*Book) ExtractChapters ¶
ExtractChapters creates file from embedded chapters
func (*Book) GenerateMetaTemplate ¶
GenerateMetaTemplate writes out the compiled metadata template for use when compiling to m4b
func (*Book) GenerateStaticChapters ¶
GenerateStaticChapters creates Chapter objects based on specified length
func (*Book) ParseFromPattern ¶
ParseFromPattern parses map of tags generated from path into attributes
func (*Book) ParseToChapters ¶
ParseToChapters creates Chapter objects out of tagged files
type Chapter ¶
type Chapter struct { LengthMs int64 StartMs int64 EndMs int64 Number int Title string Tracks []TrackFile }
Chapter holds data for each chapter construct
func (*Chapter) Compile ¶
func (c *Chapter) Compile()
Compile compiles Chapter length based off the collection of tracks associated to the chapter
func (*Chapter) StampTimes ¶
StampTimes compiles the start and end time for each chapter
type Config ¶
type Config struct { // ChaptersFile file handler for chapters file ChaptersFile *os.File // DescriptionFilename optional filename for book description data DescriptionFilename string // ExternalChapters pull chapters from existing file ExternalChapters bool // Jobs number of concurrent transcode jobs to run Jobs int `yaml:"jobs" env:"JOBS"` // OutputFileDest path to output file TODO allow for custom file name OutputFileDest string `yaml:"output_file_dest" env:"OUTPUT_FILE_DEST"` // OutputFilePattern placeholder for output filename template OutputFilePattern string `yaml:"output_file_pattern" env:"OUTPUT_FILE_PATTERN"` // OutputPathPattern placeholder for output path template OutputPathPattern string `yaml:"output_path_pattern" env:"OUTPUT_PATH_PATTERN"` // PathPattern placeholder template string PathPattern string `yaml:"path_pattern" env:"PATH_PATTERN"` // ScratchFilesPath path to put scratch files ScratchFilesPath string `yaml:"scratch_files_path" env:"SCRATCH_FILES_PATH"` // SourceFilesPath wildcard glob of files to use as input TODO refine this into options SourceFilesPath string // TracksFile file handler for tracks to transcode/compile file TracksFile *os.File // VerboseTranscode show verbose output of ffmpeg commands VerboseTranscode bool // OutputFile filename of final book output file OutputFile string // OutputPath rendered path directories OutputPath string // contains filtered or unexported fields }
Config application config data
func ParseConfig ¶
ParseConfig returns a config struct from a config file
func (*Config) SetOutputFilename ¶
SetOutputFilename sets the output filename based on metadata