Replace os.Rename with util.SafeMove to allow cross device moving to not fail. (#745)

Fixed annoyingly noisy transcoding progress log messages.
Fixed minor minor issue with directories than are named "blah.mp4" being detected as files to be scanned.
This commit is contained in:
JoeSmithStarkers
2020-08-21 17:57:07 +10:00
committed by GitHub
parent 6a3588e4e0
commit 85aa1d8790
7 changed files with 70 additions and 14 deletions

View File

@@ -100,6 +100,7 @@ func (e *Encoder) run(probeResult VideoFile, args []string) (string, error) {
}
buf := make([]byte, 80)
lastProgress := 0.0
var errBuilder strings.Builder
for {
n, err := stderr.Read(buf)
@@ -108,7 +109,11 @@ func (e *Encoder) run(probeResult VideoFile, args []string) (string, error) {
time := GetTimeFromRegex(data)
if time > 0 && probeResult.Duration > 0 {
progress := time / probeResult.Duration
logger.Infof("Progress %.2f", progress)
if progress > lastProgress+0.01 {
logger.Infof("Progress %.2f", progress)
lastProgress = progress
}
}
errBuilder.WriteString(data)