mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 08:12:36 +02:00
move epubprogress outside epub
This commit is contained in:
parent
98aa128f3e
commit
63f980e4cb
@ -18,10 +18,10 @@ import (
|
||||
epubimage "github.com/celogeek/go-comic-converter/v2/pkg/epub/image"
|
||||
epubimageprocessor "github.com/celogeek/go-comic-converter/v2/pkg/epub/imageprocessor"
|
||||
epuboptions "github.com/celogeek/go-comic-converter/v2/pkg/epub/options"
|
||||
epubprogress "github.com/celogeek/go-comic-converter/v2/pkg/epub/progress"
|
||||
epubtemplates "github.com/celogeek/go-comic-converter/v2/pkg/epub/templates"
|
||||
epubtree "github.com/celogeek/go-comic-converter/v2/pkg/epub/tree"
|
||||
epubzip "github.com/celogeek/go-comic-converter/v2/pkg/epub/zip"
|
||||
"github.com/celogeek/go-comic-converter/v2/pkg/epubprogress"
|
||||
"github.com/gofrs/uuid"
|
||||
)
|
||||
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
epubimage "github.com/celogeek/go-comic-converter/v2/pkg/epub/image"
|
||||
epubimagefilters "github.com/celogeek/go-comic-converter/v2/pkg/epub/imagefilters"
|
||||
epuboptions "github.com/celogeek/go-comic-converter/v2/pkg/epub/options"
|
||||
epubprogress "github.com/celogeek/go-comic-converter/v2/pkg/epub/progress"
|
||||
epubzip "github.com/celogeek/go-comic-converter/v2/pkg/epub/zip"
|
||||
"github.com/celogeek/go-comic-converter/v2/pkg/epubprogress"
|
||||
"github.com/disintegration/gift"
|
||||
)
|
||||
|
@ -20,12 +20,12 @@ type Options struct {
|
||||
TotalJob int
|
||||
}
|
||||
|
||||
type EpubProgress interface {
|
||||
type epubProgress interface {
|
||||
Add(num int) error
|
||||
Close() error
|
||||
}
|
||||
|
||||
func New(o Options) EpubProgress {
|
||||
func New(o Options) epubProgress {
|
||||
if o.Quiet {
|
||||
return progressbar.DefaultSilent(int64(o.Max))
|
||||
}
|
@ -5,20 +5,20 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type EpubProgressJson struct {
|
||||
type epubProgressJson struct {
|
||||
o Options
|
||||
e *json.Encoder
|
||||
current int
|
||||
}
|
||||
|
||||
func newEpubProgressJson(o Options) EpubProgress {
|
||||
return &EpubProgressJson{
|
||||
func newEpubProgressJson(o Options) epubProgress {
|
||||
return &epubProgressJson{
|
||||
o: o,
|
||||
e: json.NewEncoder(os.Stdout),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *EpubProgressJson) Add(num int) error {
|
||||
func (p *epubProgressJson) Add(num int) error {
|
||||
p.current += num
|
||||
p.e.Encode(map[string]any{
|
||||
"type": "progress",
|
||||
@ -37,6 +37,6 @@ func (p *EpubProgressJson) Add(num int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *EpubProgressJson) Close() error {
|
||||
func (p *epubProgressJson) Close() error {
|
||||
return nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user