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

@@ -6,6 +6,7 @@ import (
"image/color"
"io/ioutil"
"math"
"os"
"path/filepath"
"strings"
@@ -120,13 +121,15 @@ func (g *SpriteGenerator) generateSpriteVTT(encoder *ffmpeg.Encoder) error {
}
logger.Infof("[generator] generating sprite vtt for %s", g.Info.VideoFile.Path)
spriteImage, err := imaging.Open(g.ImageOutputPath)
spriteImage, err := os.Open(g.ImageOutputPath)
if err != nil {
return err
}
defer spriteImage.Close()
spriteImageName := filepath.Base(g.ImageOutputPath)
width := spriteImage.Bounds().Size().X / g.Columns
height := spriteImage.Bounds().Size().Y / g.Rows
image, _, err := image.DecodeConfig(spriteImage)
width := image.Width / g.Columns
height := image.Height / g.Rows
stepSize := float64(g.Info.NthFrame) / g.Info.FrameRate