From c71cf11fe495b250b6d057963fa0416e706e963b Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sun, 10 Dec 2023 09:19:00 +0100 Subject: Add another progress bar --- main.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 91a99a8..45a5b51 100644 --- a/main.go +++ b/main.go @@ -694,15 +694,17 @@ func cmdDhash(args []string) error { hasher, hexSHA1 := args[1], args[2:] if len(hexSHA1) == 0 { var err error - hexSHA1, err = dbCollectStrings(`SELECT sha1 FROM image - WHERE dhash IS NULL`) + hexSHA1, err = dbCollectStrings(` + SELECT sha1 FROM image WHERE dhash IS NULL`) if err != nil { return err } } - // TODO: Try to run the hasher in parallel, somehow. - // TODO: Show progress in some manner. Perhaps port my propeller code. + pb := newProgressBar(len(hexSHA1)) + defer pb.Stop() + + // TODO: Also run the hasher in parallel, once it becomes a problem. for _, sha1 := range hexSHA1 { pathThumb := thumbPath(sha1) hash, err := makeDhash(hasher, pathThumb) @@ -715,6 +717,8 @@ func cmdDhash(args []string) error { if err != nil { return err } + + pb.Step() } return nil } -- cgit v1.2.3-70-g09d2