Use goroutine for prefetch (#12)

This commit is contained in:
Nova Kwok 2020-02-29 19:03:26 +08:00 committed by GitHub
parent 73884394d9
commit c45af53b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,7 +229,7 @@ func prefetchImages(confImgPath string, QUALITY string) {
_, p2 := genWebpAbs(picAbsPath, info.Name(), proposedURI) _, p2 := genWebpAbs(picAbsPath, info.Name(), proposedURI)
q, _ := strconv.ParseFloat(QUALITY, 32) q, _ := strconv.ParseFloat(QUALITY, 32)
_ = os.MkdirAll(path.Dir(p2), os.ModePerm) _ = os.MkdirAll(path.Dir(p2), os.ModePerm)
_ = webpEncoder(picAbsPath, p2, float32(q), false) go webpEncoder(picAbsPath, p2, float32(q), false)
count += 1 count += 1
// progress bar // progress bar
_, _ = fmt.Fprintf(os.Stdout, "Convert in progress: %d/%d\r", count, all) _, _ = fmt.Fprintf(os.Stdout, "Convert in progress: %d/%d\r", count, all)