mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user