diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2023-12-10 09:19:00 +0100 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2023-12-10 09:20:10 +0100 | 
| commit | c71cf11fe495b250b6d057963fa0416e706e963b (patch) | |
| tree | 4e1518175fd1a449d7b577d33e14a549c31fa8d4 | |
| parent | e20f93aa6714868141159d8d855c11ef704e5507 (diff) | |
| download | gallery-c71cf11fe495b250b6d057963fa0416e706e963b.tar.gz gallery-c71cf11fe495b250b6d057963fa0416e706e963b.tar.xz gallery-c71cf11fe495b250b6d057963fa0416e706e963b.zip  | |
Add another progress bar
| -rw-r--r-- | main.go | 12 | 
1 files changed, 8 insertions, 4 deletions
@@ -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  }  | 
