Documentation
¶
Index ¶
- Constants
- func ArchiveEntryNamesFromSummary(raw json.RawMessage) []string
- func ArchiveFamilyFiles(candidateFile string, files []pgindex.CatalogReleaseFile) []pgindex.CatalogReleaseFile
- func ArchiveFamilyKey(fileName string) string
- func ArchiveProbePath(fileName string) string
- func BestMediaEntry(entries []string) string
- func BestPreviewImageEntry(entries []string) string
- func CleanupStaleWorkspaceRoots(ctx context.Context, opts Options) (int, error)
- func DetectMIMEType(data []byte, fileName string) string
- func DetectSignature(data []byte, fileName string) string
- func ExtractPasswordCandidates(values ...string) []string
- func ExtractTextTokens(text string) []string
- func InferEncrypted(candidate pgindex.BinaryInspectionCandidate) bool
- func IsArchiveFile(fileName string) bool
- func IsArchiveRepresentative(fileName string) bool
- func IsAudioFile(fileName string) bool
- func IsVideoFile(fileName string) bool
- func MarshalArchiveEntries(entries []string) json.RawMessage
- func ParseInt64(value string) int64
- func ParseSeconds(value string) float64
- func RunFFmpegThumbnail(ctx context.Context, runner CommandRunner, ffmpegPath, targetPath string) ([]byte, error)
- func RunFFmpegThumbnailInput(ctx context.Context, runner CommandRunner, ffmpegPath string, input io.Reader) ([]byte, error)
- func ToolProvenance(opts Options, stageName string) map[string]any
- type ArchiveEntryInfo
- type ArchiveMediaMaterialization
- type ArchiveProbeResult
- type ArticleFetcher
- type BinaryPrefixSample
- type CatalogReader
- type CommandRunner
- type ContentFilterDecision
- type ExecCommandRunner
- type FFProbeFormat
- type FFProbeResult
- func ParseMatroskaHeader(prefix []byte, exactSize int64) (*FFProbeResult, error)
- func ParseMatroskaHeaderReader(reader io.Reader, exactSize int64) (*FFProbeResult, error)
- func RunFFProbe(ctx context.Context, runner CommandRunner, ffprobePath, targetPath string) (*FFProbeResult, []byte, error)
- func RunFFProbeInput(ctx context.Context, runner CommandRunner, ffprobePath string, input io.Reader) (*FFProbeResult, []byte, error)
- type FFProbeStream
- type MaterializedBinary
- type Options
- type Runner
- type Service
- type Workspace
- type WorkspaceManager
Constants ¶
View Source
const WorkspaceStaleTTL = 6 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func ArchiveEntryNamesFromSummary ¶
func ArchiveEntryNamesFromSummary(raw json.RawMessage) []string
func ArchiveFamilyFiles ¶
func ArchiveFamilyFiles(candidateFile string, files []pgindex.CatalogReleaseFile) []pgindex.CatalogReleaseFile
func ArchiveFamilyKey ¶
func ArchiveProbePath ¶
func BestMediaEntry ¶
func BestPreviewImageEntry ¶ added in v0.8.0
func CleanupStaleWorkspaceRoots ¶ added in v0.8.0
func DetectMIMEType ¶
func DetectSignature ¶
func ExtractTextTokens ¶
func InferEncrypted ¶
func InferEncrypted(candidate pgindex.BinaryInspectionCandidate) bool
func IsArchiveFile ¶
func IsArchiveRepresentative ¶
func IsAudioFile ¶
func IsVideoFile ¶
func MarshalArchiveEntries ¶
func MarshalArchiveEntries(entries []string) json.RawMessage
func ParseInt64 ¶
func ParseSeconds ¶
func RunFFmpegThumbnail ¶ added in v0.8.0
func RunFFmpegThumbnailInput ¶ added in v0.8.0
Types ¶
type ArchiveEntryInfo ¶
type ArchiveMediaMaterialization ¶
type ArchiveMediaMaterialization struct {
ArchivePath string
ArchiveBytes int64
ExtractedBytes int64
Signature string
MIMEType string
ExtractStderr string
PartialExtraction bool
FFProbeResult *FFProbeResult
FFProbeOutput []byte
FFProbeError string
}
func MaterializeArchiveMediaToWorkspace ¶
func MaterializeArchiveMediaToWorkspace(ctx context.Context, repo CatalogReader, fetcher ArticleFetcher, runner CommandRunner, candidate pgindex.BinaryInspectionCandidate, entryName string, workspaceDir string, opts Options, log logger) (*ArchiveMediaMaterialization, error)
type ArchiveProbeResult ¶
type ArchiveProbeResult struct {
Strategy string
ProbePath string
MaterializedBytes int64
Entries []ArchiveEntryInfo
EntryNames []string
Encrypted bool
ProbeError string
FamilyFileNames []string
}
func PrepareArchiveProbe ¶
func PrepareArchiveProbe(ctx context.Context, workspace *Workspace, repo CatalogReader, fetcher ArticleFetcher, runner CommandRunner, log logger, opts Options, candidate pgindex.BinaryInspectionCandidate) (*ArchiveProbeResult, error)
type ArticleFetcher ¶
type BinaryPrefixSample ¶
type BinaryPrefixSample struct {
File pgindex.CatalogReleaseFile
Groups []string
Prefix []byte
Signature string
MIMEType string
BytesRead int64
ExactSize int64
OutputName string
}
func SampleBinaryPrefix ¶
func SampleBinaryPrefix(ctx context.Context, repo CatalogReader, fetcher ArticleFetcher, candidate pgindex.BinaryInspectionCandidate, maxBytes int64) (*BinaryPrefixSample, error)
type CatalogReader ¶
type CatalogReader interface {
ListCatalogReleaseFiles(ctx context.Context, releaseID string) ([]pgindex.CatalogReleaseFile, error)
ListCatalogReleaseFileArticles(ctx context.Context, releaseFileID int64) ([]pgindex.CatalogArticleRef, error)
ListCatalogReleaseNewsgroups(ctx context.Context, releaseID string) ([]string, error)
}
type CommandRunner ¶
type ContentFilterDecision ¶ added in v0.7.3
func EvaluateContentFilter ¶ added in v0.7.3
func EvaluateContentFilter(opts Options, sample *BinaryPrefixSample) ContentFilterDecision
type FFProbeFormat ¶
type FFProbeFormat struct {
Filename string `json:"filename"`
FormatName string `json:"format_name"`
FormatLongName string `json:"format_long_name"`
Duration string `json:"duration"`
BitRate string `json:"bit_rate"`
Size string `json:"size"`
ProbeScore int `json:"probe_score"`
Tags map[string]string `json:"tags"`
}
type FFProbeResult ¶
type FFProbeResult struct {
Format FFProbeFormat `json:"format"`
Streams []FFProbeStream `json:"streams"`
}
func ParseMatroskaHeader ¶ added in v0.9.0
func ParseMatroskaHeader(prefix []byte, exactSize int64) (*FFProbeResult, error)
ParseMatroskaHeader reads only the EBML header, segment info, and track definitions. The Tracks stop tag prevents payload clusters from being read.
func ParseMatroskaHeaderReader ¶ added in v0.9.0
func ParseMatroskaHeaderReader(reader io.Reader, exactSize int64) (*FFProbeResult, error)
ParseMatroskaHeaderReader stops reading as soon as the Tracks element ends. This lets archive inspection parse metadata directly from an extraction pipe without draining the media payload that follows it.
func RunFFProbe ¶
func RunFFProbe(ctx context.Context, runner CommandRunner, ffprobePath, targetPath string) (*FFProbeResult, []byte, error)
func RunFFProbeInput ¶ added in v0.7.2
func RunFFProbeInput(ctx context.Context, runner CommandRunner, ffprobePath string, input io.Reader) (*FFProbeResult, []byte, error)
type FFProbeStream ¶
type FFProbeStream struct {
Index int `json:"index"`
CodecType string `json:"codec_type"`
CodecName string `json:"codec_name"`
CodecLong string `json:"codec_long_name"`
CodecTagString string `json:"codec_tag_string"`
CodecTag string `json:"codec_tag"`
Profile string `json:"profile"`
Width int `json:"width"`
Height int `json:"height"`
Channels int `json:"channels"`
SampleRate string `json:"sample_rate"`
ChannelLayout string `json:"channel_layout"`
SampleFormat string `json:"sample_fmt"`
BitsPerSample int `json:"bits_per_sample"`
PixFmt string `json:"pix_fmt"`
DisplayAspectRatio string `json:"display_aspect_ratio"`
RFrameRate string `json:"r_frame_rate"`
AvgFrameRate string `json:"avg_frame_rate"`
Duration string `json:"duration"`
BitRate string `json:"bit_rate"`
Tags map[string]string `json:"tags"`
Disposition struct {
Default int `json:"default"`
Forced int `json:"forced"`
} `json:"disposition"`
}
type MaterializedBinary ¶
type MaterializedBinary struct {
File pgindex.CatalogReleaseFile
Groups []string
Header *nzb.YencHeader
OutputPath string
BytesWritten int64
ExactSize int64
Signature string
MIMEType string
}
func MaterializeBinaryToWorkspace ¶
func MaterializeBinaryToWorkspace(ctx context.Context, repo CatalogReader, fetcher ArticleFetcher, candidate pgindex.BinaryInspectionCandidate, outputPath string, maxBytes int64) (*MaterializedBinary, error)
type Options ¶
type Options struct {
WorkDir string
WorkspaceBackend string
MemoryWorkDir string
MaxBytes int64
MinBinaryBytes int64
MaxBinaryBytes int64
RequireExpectedFileCount bool
BlockedMagicHex []string
MaxArchiveDepth int
ToolTimeout time.Duration
FFmpegPath string
FFProbePath string
SevenZipPath string
UnrarPath string
PAR2Path string
CandidateBatchSize int
Concurrency int
ClaimOwner string
ClaimLease time.Duration
BodyRequestsPerHour int64
}
func DefaultOptions ¶
type WorkspaceManager ¶
type WorkspaceManager struct {
// contains filtered or unexported fields
}
func NewWorkspaceManager ¶
func NewWorkspaceManager(opts Options) *WorkspaceManager
func (*WorkspaceManager) PrepareBinaryWorkspace ¶
func (m *WorkspaceManager) PrepareBinaryWorkspace(ctx context.Context, stageName string, candidate pgindex.BinaryInspectionCandidate) (*Workspace, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.