Fix crash when generating thumbnail during scan

This commit is contained in:
WithoutPants 2024-02-23 11:20:07 +11:00
parent f2bc3d5567
commit a302fc78ea
1 changed files with 6 additions and 6 deletions

View File

@ -409,10 +409,15 @@ func (g *imageGenerators) Generate(ctx context.Context, i *models.Image, f model
t := g.input
path := f.Base().Path
// this is a bit of a hack: the task requires files to be loaded, but
// we don't really need to since we already have the file
ii := *i
ii.Files = models.NewRelatedFiles([]models.File{f})
if t.ScanGenerateThumbnails {
// this should be quick, so always generate sequentially
taskThumbnail := GenerateImageThumbnailTask{
Image: *i,
Image: ii,
Overwrite: overwrite,
}
@ -422,11 +427,6 @@ func (g *imageGenerators) Generate(ctx context.Context, i *models.Image, f model
// avoid adding a task if the file isn't a video file
_, isVideo := f.(*models.VideoFile)
if isVideo && t.ScanGenerateClipPreviews {
// this is a bit of a hack: the task requires files to be loaded, but
// we don't really need to since we already have the file
ii := *i
ii.Files = models.NewRelatedFiles([]models.File{f})
progress.AddTotal(1)
previewsFn := func(ctx context.Context) {
taskPreview := GenerateClipPreviewTask{