mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix cover generation error
This commit is contained in:
@@ -21,17 +21,20 @@ func (t *GenerateCoverTask) GetDescription() string {
|
||||
}
|
||||
|
||||
func (t *GenerateCoverTask) Start(ctx context.Context) {
|
||||
if !t.required(ctx) {
|
||||
return
|
||||
}
|
||||
|
||||
scenePath := t.Scene.Path
|
||||
|
||||
var required bool
|
||||
if err := t.txnManager.WithReadTxn(ctx, func(ctx context.Context) error {
|
||||
required = t.required(ctx)
|
||||
|
||||
return t.Scene.LoadPrimaryFile(ctx, t.txnManager.File)
|
||||
}); err != nil {
|
||||
logger.Error(err)
|
||||
}
|
||||
|
||||
if !required {
|
||||
return
|
||||
}
|
||||
|
||||
videoFile := t.Scene.Files.Primary()
|
||||
if videoFile == nil {
|
||||
@@ -89,6 +92,7 @@ func (t *GenerateCoverTask) Start(ctx context.Context) {
|
||||
}
|
||||
|
||||
// required returns true if the sprite needs to be generated
|
||||
// assumes in a transaction
|
||||
func (t *GenerateCoverTask) required(ctx context.Context) bool {
|
||||
if t.Scene.Path == "" {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user