Minor optimization.
Raised "progress=end" after data:= Scanner Out.Text().
This commit is contained in:
		@@ -164,6 +164,14 @@ 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() {
 | 
				
			||||||
		data := scannerOut.Text()
 | 
							data := scannerOut.Text()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if strings.Contains(data, "progress=end") {
 | 
				
			||||||
 | 
								p.progressbar.Value = p.totalDuration
 | 
				
			||||||
 | 
								p.progressbar.Refresh()
 | 
				
			||||||
 | 
								isProcessCompleted = true
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		re := regexp.MustCompile(`frame=(\d+)`)
 | 
							re := regexp.MustCompile(`frame=(\d+)`)
 | 
				
			||||||
		a := re.FindAllStringSubmatch(data, -1)
 | 
							a := re.FindAllStringSubmatch(data, -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -174,12 +182,6 @@ func (p progress) Run(stdOut io.ReadCloser, stdErr io.ReadCloser) error {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			progress = float64(c)
 | 
								progress = float64(c)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if strings.Contains(data, "progress=end") {
 | 
					 | 
				
			||||||
			p.progressbar.Value = p.totalDuration
 | 
					 | 
				
			||||||
			p.progressbar.Refresh()
 | 
					 | 
				
			||||||
			isProcessCompleted = true
 | 
					 | 
				
			||||||
			break
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if p.progressbar.Value != progress {
 | 
							if p.progressbar.Value != progress {
 | 
				
			||||||
			p.progressbar.Value = progress
 | 
								p.progressbar.Value = progress
 | 
				
			||||||
			p.progressbar.Refresh()
 | 
								p.progressbar.Refresh()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user