aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-12-10 09:19:00 +0100
committerPřemysl Eric Janouch <p@janouch.name>2023-12-10 09:20:10 +0100
commitc71cf11fe495b250b6d057963fa0416e706e963b (patch)
tree4e1518175fd1a449d7b577d33e14a549c31fa8d4 /main.go
parente20f93aa6714868141159d8d855c11ef704e5507 (diff)
downloadgallery-c71cf11fe495b250b6d057963fa0416e706e963b.tar.gz
gallery-c71cf11fe495b250b6d057963fa0416e706e963b.tar.xz
gallery-c71cf11fe495b250b6d057963fa0416e706e963b.zip
Add another progress bar
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files 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
}