gather

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

package gather provides methods for compiling (gathering) a list of images to be processed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrawlImages added in v0.0.8

func CrawlImages(ctx context.Context, opts *GatherImagesOptions, rsp_ch chan *GatherImagesResponse) error

Iterate through all the items stored in a blob.Bucket instance, generate a GatherImagesResponse for things that are images and dispatch that response to a user-defined channel.

func GatherImages added in v0.0.8

func GatherImages(ctx context.Context, bucket *blob.Bucket, cb GatherImageCallbackFunc) error

GatherImages will gather images from bucket enabling image hashing by default.

func GatherImagesWithOptions added in v0.0.8

func GatherImagesWithOptions(ctx context.Context, opts *GatherImagesOptions) error

GatherImages will gather images from bucket with custom configuration options.

Types

type GatherImageCallbackFunc added in v0.0.8

type GatherImageCallbackFunc func(*GatherImagesResponse) error

type GatherImageCallbackFunc provides a function signature for custom callbacks applied to gathered images.

type GatherImagesOptions added in v0.0.8

type GatherImagesOptions struct {
	Bucket *blob.Bucket
	// A custom callback function to be applied to each image that is gathered
	Callback GatherImageCallbackFunc
	// A boolean flag indicating whether image hashes should be calculated for gathered images
	EmbossImages bool
	// A valid sfomuseum/go-text-emboss.Embosser instance used to extract text from gathered images
	Embosser emboss.Embosser
}

type GatherImagesOptions provides configuration options for gathering images

type GatherImagesResponse added in v0.0.8

type GatherImagesResponse struct {
	// The path to the image file being gathered
	Path string
	// The SHA-1 hash of the file (defined in Path)
	Fingerprint string
	// The mimetype of the image file being gathered
	MimeType string
	// The set of image hashes for the image file being gathered
	ImageHashes []*common.ImageHashRsp
	// Text extracted from the image using the `sfomuseum/go-text-emboss` package.
	ImageText []byte
}

type GatherImagesResponse provides a struct containing basic information about a file.

func GatherImageResponseWithPath added in v0.0.14

func GatherImageResponseWithPath(ctx context.Context, opts *GatherImagesOptions, path string) (*GatherImagesResponse, error)

GatherImageResponseWithPath will generate a single GatherImagesResponse response for `path` (contained in `bucket`).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL