"time"
"github.com/dustin/go-humanize"
- "go.cypherpunks.ru/nncp/v5/uilive"
+ "go.cypherpunks.ru/nncp/v8/uilive"
)
func init() {
break
}
}
+ if showPrgrs {
+ for _, le := range les {
+ if le.K == "FullSize" {
+ if le.V.(int64) == 0 {
+ Progress(prgrsPrefix, append(
+ les, LE{"Size", written}, LE{"FullSize", written},
+ ))
+ }
+ break
+ }
+ }
+ }
return
}
}
}
progressBarsLock.RLock()
- pb, exists := progressBars[pkt]
+ pb := progressBars[pkt]
progressBarsLock.RUnlock()
- if !exists {
+ if pb == nil {
progressBarsLock.Lock()
pb = ProgressBarNew(size, fullsize)
progressBars[pkt] = pb
progressBarsLock.Unlock()
}
what := pkt
- if len(what) >= 52 { // Base32 encoded
+ if len(what) >= Base32Encoded32Len { // Base32 encoded
what = what[:16] + ".." + what[len(what)-16:]
}
what = prefix + " " + what
pb.Render(what, size)
- if size >= fullsize {
+ if fullsize != 0 && size >= fullsize {
pb.Kill()
progressBarsLock.Lock()
delete(progressBars, pkt)
progressBarsLock.Unlock()
}
}
+
+func ProgressKill(pkt string) {
+ progressBarsLock.Lock()
+ pb := progressBars[pkt]
+ if pb != nil {
+ pb.Kill()
+ delete(progressBars, pkt)
+ }
+ progressBarsLock.Unlock()
+}