mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-24 15:52:38 +02:00
34 lines
568 B
Go
34 lines
568 B
Go
package epubprogress
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
type jsonprogress struct {
|
|
o Options
|
|
e *json.Encoder
|
|
current int
|
|
}
|
|
|
|
func (p *jsonprogress) Add(num int) error {
|
|
p.current += num
|
|
return p.e.Encode(map[string]any{
|
|
"type": "epubprogress",
|
|
"data": map[string]any{
|
|
"epubprogress": map[string]any{
|
|
"current": p.current,
|
|
"total": p.o.Max,
|
|
},
|
|
"steps": map[string]any{
|
|
"current": p.o.CurrentJob,
|
|
"total": p.o.TotalJob,
|
|
},
|
|
"description": p.o.Description,
|
|
},
|
|
})
|
|
}
|
|
|
|
func (p *jsonprogress) Close() error {
|
|
return nil
|
|
}
|