Include database cover in draft submission if filesystem version not present (#3465)

* Fix styling of stash-box dropdown
* Use cover blob in draft submission if present
This commit is contained in:
WithoutPants
2023-02-27 10:28:00 +11:00
committed by GitHub
parent dc934d73fa
commit 967a25f64a
6 changed files with 31 additions and 14 deletions

View File

@@ -8,6 +8,7 @@ import (
"os"
"github.com/stashapp/stash/pkg/file"
"github.com/stashapp/stash/pkg/fsutil"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/models/paths"
@@ -86,3 +87,17 @@ func SetScreenshot(paths *paths.Paths, checksum string, imageData []byte) error
return err
}
func (s *Service) GetCover(ctx context.Context, scene *models.Scene) ([]byte, error) {
if scene.Path != "" {
filepath := s.Paths.Scene.GetScreenshotPath(scene.GetHash(s.Config.GetVideoFileNamingAlgorithm()))
// fall back to the scene image blob if the file isn't present
screenshotExists, _ := fsutil.FileExists(filepath)
if screenshotExists {
return os.ReadFile(filepath)
}
}
return s.Repository.GetCover(ctx, scene.ID)
}