Fix vtt sprite generation ( issue #1033 ) (#1035)

This commit is contained in:
bnkai
2021-01-14 03:53:42 +02:00
committed by GitHub
parent aad4ddc46d
commit defb23aaa2
13 changed files with 44 additions and 925 deletions

View File

@@ -11,9 +11,9 @@ import (
"sort"
"strings"
"github.com/bmatcuk/doublestar/v2"
"github.com/disintegration/imaging"
"github.com/fvbommel/sortorder"
"github.com/stashapp/stash/pkg/ffmpeg"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/utils"
@@ -89,8 +89,11 @@ func (g *SpriteGenerator) generateSpriteImage(encoder *ffmpeg.Encoder) error {
}
// Combine all of the thumbnails into a sprite image
globPath := filepath.Join(instance.Paths.Generated.Tmp, fmt.Sprintf("thumbnail_%s_*.jpg", g.VideoChecksum))
imagePaths, _ := doublestar.Glob(globPath)
pattern := fmt.Sprintf("thumbnail_%s_.+\\.jpg$", g.VideoChecksum)
imagePaths, err := utils.MatchEntries(instance.Paths.Generated.Tmp, pattern)
if err != nil {
return err
}
sort.Sort(sortorder.Natural(imagePaths))
var images []image.Image
for _, imagePath := range imagePaths {