remove confirmation on prefetch

This commit is contained in:
Benny~ 2020-03-10 21:21:54 +08:00
parent e1c4738b1d
commit 72dda9a1a6
No known key found for this signature in database
GPG Key ID: 6CD0DBDA5235D481

View File

@ -1,7 +1,6 @@
package main
import (
"bufio"
"fmt"
"os"
"path"
@ -13,18 +12,13 @@ import (
)
func PrefetchImages(confImgPath string, ExhaustPath string, QUALITY string) {
fmt.Println(`Prefetch will convert all your images to webp,
it may take some time and consume a lot of CPU resource. Do you want to proceed(Y/n)`)
reader := bufio.NewReader(os.Stdin)
char, _, _ := reader.ReadRune() //y Y enter
// maximum ongoing prefetch is depending on your core of CPU
log.Infof("Prefetching using %d cores", jobs)
var finishChan = make(chan int, jobs)
for i := 0; i < jobs; i++ {
finishChan <- 0
}
if char == 121 || char == 10 || char == 89 {
//prefetch, recursive through the dir
all := FileCount(confImgPath)
count := 0
@ -47,7 +41,6 @@ it may take some time and consume a lot of CPU resource. Do you want to proceed(
if err != nil {
log.Debug(err)
}
}
_, _ = fmt.Fprintf(os.Stdout, "Prefetch completeY(^_^)Y\n\n")