From 6f5eb6a1caf6dad5e3690a4cb11a00aaf85f0088 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Wed, 6 Dec 2023 16:37:25 +0100 Subject: [PATCH] Also show image hashing bar --- filesmap.go | 4 +++- main.go | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/filesmap.go b/filesmap.go index f36bf1e..f34ea81 100644 --- a/filesmap.go +++ b/filesmap.go @@ -33,6 +33,8 @@ type FilesMap struct { fileHashingBar *mpb.Bar + imageHashingBar *mpb.Bar + lock sync.Mutex } @@ -75,7 +77,7 @@ func (fm *FilesMap) ImageHashingWorker(wg *sync.WaitGroup) { } hash, err := calculateImageHash(file.path) - //fm.hashingBar.IncrInt64(file.size) + fm.imageHashingBar.IncrInt64(file.size) if err != nil { log.Printf("Error calculating Hash for image %s: %v\n", file.path, err) diff --git a/main.go b/main.go index 11e8e87..3df9a51 100644 --- a/main.go +++ b/main.go @@ -69,7 +69,19 @@ func main() { decor.AverageSpeed(decor.UnitKiB, "%23.2f"), decor.Name(" "), decor.CurrentKibiByte("%5d"), - )) + ), + ) + filesMap.imageHashingBar = filesMap.progress.AddBar(0, + mpb.PrependDecorators( + decor.Name("Hashing images "), + decor.Elapsed(decor.ET_STYLE_HHMMSS), + ), + mpb.AppendDecorators( + decor.AverageSpeed(decor.UnitKiB, "%23.2f"), + decor.Name(" "), + decor.CurrentKibiByte("%5d"), + ), + ) done := make(chan bool) wg := sync.WaitGroup{} for i := 0; i < runtime.GOMAXPROCS(0); i++ {