Fixed a bug when the video was fully converted, but the progress bar showed not 100, but, for example, 99.

This commit is contained in:
Leonid Nikitin 2024-01-27 21:08:27 +06:00
parent 846986279c
commit d68382e418
Signed by: kor-elf
GPG Key ID: 7DE8F80C5CEC2C0D

View File

@ -163,9 +163,6 @@ func (p progress) Run(stdOut io.ReadCloser, stdErr io.ReadCloser) error {
scannerOut := bufio.NewScanner(stdOut) scannerOut := bufio.NewScanner(stdOut)
for scannerOut.Scan() { for scannerOut.Scan() {
if isProcessCompleted != true {
isProcessCompleted = true
}
data := scannerOut.Text() data := scannerOut.Text()
re := regexp.MustCompile(`frame=(\d+)`) re := regexp.MustCompile(`frame=(\d+)`)
a := re.FindAllStringSubmatch(data, -1) a := re.FindAllStringSubmatch(data, -1)
@ -181,6 +178,7 @@ func (p progress) Run(stdOut io.ReadCloser, stdErr io.ReadCloser) error {
p.progressbar.Value = p.totalDuration p.progressbar.Value = p.totalDuration
p.progressbar.Refresh() p.progressbar.Refresh()
isProcessCompleted = true isProcessCompleted = true
break
} }
if p.progressbar.Value != progress { if p.progressbar.Value != progress {
p.progressbar.Value = progress p.progressbar.Value = progress