func (g Generator) PreviewWebp(ctx context.Context, input string, hash string) error {
	lockCtx := g.LockManager.ReadLock(ctx, input)
	defer lockCtx.Cancel()

	output := g.ScenePaths.GetWebpPreviewPath(hash)
	if !g.Overwrite {
		if exists, _ := fsutil.FileExists(output); exists {
			return nil
		}
	}

	logger.Infof("[generator] generating webp preview for %s", input)

	src := g.ScenePaths.GetVideoPreviewPath(hash)

	if err := g.generateFile(lockCtx, g.ScenePaths, webpPattern, output, g.previewVideoToImage(src)); err != nil {
		return err
	}

	logger.Debug("created video preview: ", output)

	return nil
}
// PreviewWebp generates a webp file based on the preview video input.
// TODO - this should really generate a new webp using chunks.
PreviewWebp generates a webp file based on the preview video input.
TODO - this should really generate a new webp using chunks.
// PreviewWebp generates a webp file based on the preview video input . // TODO - this should really generate a new webp using chunks .
func (g Generator) PreviewWebp(ctx context.Context, input string, hash string) error {
	lockCtx := g.LockManager.ReadLock(ctx, input)
	defer lockCtx.Cancel()
	output := g.ScenePaths.GetWebpPreviewPath(hash)
	if !g.Overwrite {
		if exists, _ := fsutil.FileExists(output); exists {
			return nil
		}
	}
	logger.Infof("[generator] generating webp preview for %s", input)
	src := g.ScenePaths.GetVideoPreviewPath(hash)
	if err := g.generateFile(lockCtx, g.ScenePaths, webpPattern, output, g.previewVideoToImage(src)); err != nil {
		return err
	}
	logger.Debug("created video preview: ", output)
	return nil
}
func ( g Generator ) PreviewWebp ( ctx context . Context , input string , hash string ) error { lockCtx := g . LockManager . ReadLock ( ctx , input ) defer lockCtx . Cancel ( ) output := g . ScenePaths . GetWebpPreviewPath ( hash ) if ! g . Overwrite { if exists , _ := fsutil . FileExists ( output ) ; exists { return nil } } logger . Infof ( " " , input ) src := g . ScenePaths . GetVideoPreviewPath ( hash ) if err := g . generateFile ( lockCtx , g . ScenePaths , webpPattern , output , g . previewVideoToImage ( src ) ) ; err != nil { return err } logger . Debug ( " " , output ) return nil }
PreviewWebp generates a webp file based on the preview video input.
PreviewWebp generates a webp file based on the preview video input .