mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Fix cover generation error
This commit is contained in:
parent
79bc5c914f
commit
f3f7ee7fd2
1 changed files with 8 additions and 4 deletions
|
|
@ -21,18 +21,21 @@ 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 {
|
||||
return
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue