Documentation ¶
Index ¶
- Constants
- Variables
- func AES128Decrypt(crypted, key, iv []byte) ([]byte, error)
- func AES128Encrypt(origData, key, iv []byte) ([]byte, error)
- func AllInOneHtml(svgContents []*SvgContent, toc []EbookToc) (result string, err error)
- func BytesToString(b []byte) string
- func CheckFileExist(filename string) bool
- func ColumnPrintToPDF(aid string, filename string, cookies map[string]string) error
- func Contains(s []int, n int) bool
- func CurrentDir(joinPath ...string) (string, error)
- func DrawProgressBar(prefix string, proportion float32, width int, suffix ...string)
- func FileName(name, ext string) string
- func FilePath(name, ext string, escape bool) (string, error)
- func FileSize(filePath string) (int, bool, error)
- func GenHeadHtml() (result string)
- func GenLineContentByElement(chapterID string, element *svgparser.Element) (lineContent map[float64][]HtmlEle)
- func GenTocHtml(toc []EbookToc) (result string)
- func GenTocLevelHtml(level int, startTag bool) (result string)
- func LimitLength(s string, length int) string
- func M3u8URLs(uri string) (urls []string, err error)
- func MD5str(s string) string
- func Md2Pdf(path, title string, md []byte) (err error)
- func MergeAudio(paths []string, mergedFilePath string) error
- func MergeAudioAndVideo(paths []string, mergedFilePath string) error
- func MergeToMP4(paths []string, mergedFilePath string, filename string) error
- func Mkdir(elem ...string) (string, error)
- func NewQrCodeTerminal() *qrcodeTerminal
- func NewQrCodeTerminal2(front, back consoleColor, level qrcodeRecoveryLevel) *qrcodeTerminal
- func OneByOneHtml(eType string, index int, svgContent *SvgContent, toc []EbookToc) (result, cover string, err error)
- func ParseBookFnDelimiter(svgContents []*SvgContent) (fnA, fnB string)
- func ResolveURL(u *url.URL, p string) string
- func SaveFile(outputDir, title, ext, content string) (err error)
- func StringToBytes(s string) []byte
- func Svg2Epub(outputDir, title string, svgContents []*SvgContent, opt EpubOptions) (err error)
- func Svg2Html(outputDir, title string, svgContents []*SvgContent, toc []EbookToc) (err error)
- func Svg2Pdf(outputDir, title string, svgContents []*SvgContent, toc []EbookToc) (err error)
- func TimeCost(start time.Time)
- func Unix2String(stamp int64) string
- func UnmarshalJSON(data []byte, v interface{}) error
- func UnmarshalReader(r io.Reader, v interface{}) error
- func WriteFileWithTrunc(filename, content string) (err error)
- type EbookToc
- type EpubOptions
- type HtmlContent
- type HtmlEle
- type HtmlToEpub
- type PdfOption
- type QRCodeString
- type SvgContent
- type SvgContents
- type ValidUTF8Reader
- type WaitGroupPool
Constants ¶
const MAXLENGTH = 80
MAXLENGTH Maximum length of file name
const TimeFormat = "2006-01-02 15:04:05"
TimeFormat format
Variables ¶
var ( ConsoleColors = consoleColors{ NormalBlack: "\033[38;5;0m \033[0m", NormalRed: "\033[38;5;1m \033[0m", NormalGreen: "\033[38;5;2m \033[0m", NormalYellow: "\033[38;5;3m \033[0m", NormalBlue: "\033[38;5;4m \033[0m", NormalMagenta: "\033[38;5;5m \033[0m", NormalCyan: "\033[38;5;6m \033[0m", NormalWhite: "\033[38;5;7m \033[0m", BrightBlack: "\033[48;5;0m \033[0m", BrightRed: "\033[48;5;1m \033[0m", BrightGreen: "\033[48;5;2m \033[0m", BrightYellow: "\033[48;5;3m \033[0m", BrightBlue: "\033[48;5;4m \033[0m", BrightMagenta: "\033[48;5;5m \033[0m", BrightCyan: "\033[48;5;6m \033[0m", BrightWhite: "\033[48;5;7m \033[0m"} QRCodeRecoveryLevels = qrcodeRecoveryLevels{ Low: qrcodeRecoveryLevel(qrcode.Low), Medium: qrcodeRecoveryLevel(qrcode.Medium), High: qrcodeRecoveryLevel(qrcode.High), Highest: qrcodeRecoveryLevel(qrcode.Highest)} )
var FfmpegDir = ""
var WkToPdfDir = ""
Functions ¶
func AES128Decrypt ¶
AES128Decrypt AES-128 decrypt
func AES128Encrypt ¶
AES128Encrypt AES-128 encrypt
func AllInOneHtml ¶
func AllInOneHtml(svgContents []*SvgContent, toc []EbookToc) (result string, err error)
AllInOneHtml generate ebook content all in one html file
func BytesToString ¶
func CheckFileExist ¶
func ColumnPrintToPDF ¶
ColumnPrintToPDF print pdf
func DrawProgressBar ¶
DrawProgressBar Draw ProgressBar
func GenHeadHtml ¶
func GenHeadHtml() (result string)
func GenLineContentByElement ¶
func GenTocHtml ¶
GenTocHtml generate toc html anchor
func GenTocLevelHtml ¶
func MergeAudio ¶
MergeAudio merge audio
func MergeAudioAndVideo ¶
MergeAudioAndVideo merge audio and video
func MergeToMP4 ¶
MergeToMP4 merges video parts to an MP4 file.
func NewQrCodeTerminal ¶
func NewQrCodeTerminal() *qrcodeTerminal
func NewQrCodeTerminal2 ¶
func NewQrCodeTerminal2(front, back consoleColor, level qrcodeRecoveryLevel) *qrcodeTerminal
func OneByOneHtml ¶
func OneByOneHtml(eType string, index int, svgContent *SvgContent, toc []EbookToc) (result, cover string, err error)
OneByOneHtml one by one generate chapter html eType: html/pdf/epub, index: []*SvgContent index, svgContent: one chapter content
func ParseBookFnDelimiter ¶
func ParseBookFnDelimiter(svgContents []*SvgContent) (fnA, fnB string)
func StringToBytes ¶
func Svg2Epub ¶
func Svg2Epub(outputDir, title string, svgContents []*SvgContent, opt EpubOptions) (err error)
func Svg2Html ¶
func Svg2Html(outputDir, title string, svgContents []*SvgContent, toc []EbookToc) (err error)
func Svg2Pdf ¶
func Svg2Pdf(outputDir, title string, svgContents []*SvgContent, toc []EbookToc) (err error)
func Unix2String ¶
Unix2String 时间戳[转换为]字符串 eg:(2019-09-09 09:09:09)
func UnmarshalJSON ¶
UnmarshalJSON 将 data 中的 json 格式的数据, 解析到 v
func UnmarshalReader ¶
UnmarshalReader 将 r 中的 json 格式的数据, 解析到 v
func WriteFileWithTrunc ¶
Types ¶
type EpubOptions ¶
type HtmlContent ¶
type HtmlEle ¶
type HtmlEle struct { X string `json:"x"` Y string `json:"y"` ID string `json:"id"` Width string `json:"width"` Height string `json:"height"` Offset string `json:"offset"` Href string `json:"href"` Name string `json:"name"` Style string `json:"style"` Content string `json:"content"` Class string `json:"class"` Alt string `json:"alt"` Len string `json:"len"` Newline bool `json:"newline"` IsBold bool `json:"is_bold"` IsItalic bool `json:"is_italic"` IsFn bool `json:"is_fn"` // footnote: sup tag IsSub bool `json:"is_sub"` // sub tag Fn struct { Href string `json:"href"` Style string `json:"style"` } `json:"fn"` TextAlign string `json:"text_align"` // left; center; right }
type HtmlToEpub ¶
type HtmlToEpub struct { EpubOptions DefaultCover []byte // contains filtered or unexported fields }
func (*HtmlToEpub) Run ¶
func (h *HtmlToEpub) Run() (err error)
type QRCodeString ¶
type QRCodeString string
func (*QRCodeString) Print ¶
func (v *QRCodeString) Print()
type SvgContent ¶
type SvgContents ¶
type SvgContents []*SvgContent
func (SvgContents) Len ¶
func (a SvgContents) Len() int
func (SvgContents) Less ¶
func (a SvgContents) Less(i, j int) bool
func (SvgContents) Swap ¶
func (a SvgContents) Swap(i, j int)
type ValidUTF8Reader ¶
type ValidUTF8Reader struct {
// contains filtered or unexported fields
}
ValidUTF8Reader implements a Reader which reads only bytes that constitute valid UTF-8
func NewValidUTF8Reader ¶
func NewValidUTF8Reader(rd io.Reader) ValidUTF8Reader
NewValidUTF8Reader constructs a new ValidUTF8Reader that wraps an existing io.Reader
type WaitGroupPool ¶
type WaitGroupPool struct {
// contains filtered or unexported fields
}
WaitGroupPool pool of WaitGroup
func NewWaitGroupPool ¶
func NewWaitGroupPool(size int) *WaitGroupPool
NewWaitGroupPool creates a sized pool for WaitGroup
func (*WaitGroupPool) Add ¶
func (p *WaitGroupPool) Add()
Add increments the WaitGroup counter by one. See sync.WaitGroup documentation for more information.
func (*WaitGroupPool) Done ¶
func (p *WaitGroupPool) Done()
Done decrements the WaitGroup counter by one. See sync.WaitGroup documentation for more information.
func (*WaitGroupPool) Wait ¶
func (p *WaitGroupPool) Wait()
Wait blocks until the WaitGroup counter is zero. See sync.WaitGroup documentation for more information.