Fix cover generation error

This commit is contained in:
WithoutPants 2023-05-04 08:24:58 +10:00 committed by GitHub
parent 79bc5c914f
commit f3f7ee7fd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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