contentverify

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opener

type Opener interface {
	OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (afero.File, error)
}

Opener abstracts *nzbfilesystem.NzbFilesystem.OpenFile for testability. nzbfilesystem.NzbFilesystem satisfies this interface structurally.

type ProbeResult

type ProbeResult struct {
	Result Result
	Err    error
}

ProbeResult is the outcome of Probe.

func Probe

func Probe(ctx context.Context, opener Opener, path string, timeout time.Duration) ProbeResult

Probe opens path through opener, reads up to the first 512 bytes with read-ahead capped to one backing article, and classifies the result. Definitive failures (ContentInvalid, ContentSegmentMissing) mean the content is confirmed bad; ContentProbeError means the check itself failed and must not be treated as a content failure.

type Result

type Result int

Result classifies the outcome of a content-signature probe.

const (
	// ContentValid means a recognized video/audio container signature was found.
	ContentValid Result = iota
	// ContentInvalid means bytes were read but no supported container
	// signature was found — a definitive failure.
	ContentInvalid
	// ContentSegmentMissing means the head article required to read the
	// file's first bytes is confirmed missing — a definitive failure.
	ContentSegmentMissing
	// ContentProbeError means the probe could not complete due to a
	// transient provider, timeout, or connection error — never definitive.
	ContentProbeError
)

func (Result) String

func (r Result) String() string

String returns the constant name, so log lines and test failures print readable values instead of bare integers.

Jump to

Keyboard shortcuts

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