processor

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI7z added in v0.4.0

type CLI7z struct {
	BinaryPath string
}

func NewCLI7z added in v0.4.0

func NewCLI7z() (*CLI7z, error)

NewCLI7z creates a new 7z extractor using the system's 7z binary

func (*CLI7z) CanExtract added in v0.4.0

func (z *CLI7z) CanExtract(filePath string) (bool, error)

CanExtract checks if the file is a 7z archive

func (*CLI7z) Extract added in v0.4.0

func (z *CLI7z) Extract(ctx context.Context, archivePath string, destDir string, password string) ([]string, error)

Extract extracts the 7z archive to the destination directory

func (*CLI7z) Name added in v0.4.0

func (z *CLI7z) Name() string

Name returns the extractor name

type CLIPar2 added in v0.4.0

type CLIPar2 struct {
	BinaryPath string
}

func NewCLIPar2 added in v0.4.0

func NewCLIPar2() (*CLIPar2, error)

func (*CLIPar2) Repair added in v0.4.0

func (c *CLIPar2) Repair(ctx context.Context, path string) error

func (*CLIPar2) Verify added in v0.4.0

func (c *CLIPar2) Verify(ctx context.Context, path string) (bool, error)

type CLIUnrar added in v0.4.0

type CLIUnrar struct {
	BinaryPath string
}

func NewCLIUnrar added in v0.4.0

func NewCLIUnrar() (*CLIUnrar, error)

NewCLIUnrar creates a new UnRAR extractor using the system's unrar binary. Returns an error if the unrar binary is not found in PATH.

func (*CLIUnrar) CanExtract added in v0.4.0

func (u *CLIUnrar) CanExtract(filePath string) (bool, error)

CanExtract checks if the file is a RAR archive by verifying: 1. File extension (.rar) 2. Magic bytes (file signature) 3. For multi-part archives, only extract the first part

func (*CLIUnrar) Extract added in v0.4.0

func (u *CLIUnrar) Extract(ctx context.Context, archivePath string, destDir string, password string) ([]string, error)

Extract extracts the RAR archive to the destination directory

func (*CLIUnrar) Name added in v0.4.0

func (u *CLIUnrar) Name() string

Name returns the extractor name

type CLIUnzip added in v0.4.0

type CLIUnzip struct {
	BinaryPath string
}

func NewCLIUnzip added in v0.4.0

func NewCLIUnzip() (*CLIUnzip, error)

func (*CLIUnzip) CanExtract added in v0.4.0

func (u *CLIUnzip) CanExtract(filePath string) (bool, error)

CanExtract checks if the file is a ZIP archive

func (*CLIUnzip) Extract added in v0.4.0

func (u *CLIUnzip) Extract(ctx context.Context, archivePath string, destDir string, password string) ([]string, error)

Extract extracts the ZIP archive to the destination directory

func (*CLIUnzip) Name added in v0.4.0

func (u *CLIUnzip) Name() string

Name returns the extractor name

type Closeable

type Closeable interface {
	CloseFile(path string, finalSize int64) error
	PreAllocate(path string, size int64) error
}

type CmdFactory added in v0.4.0

type CmdFactory func(workDir string) *exec.Cmd

type Extractor added in v0.4.0

type Extractor interface {
	// Extract extracts the archive at the given path to the destination directory.
	// Returns the list of extracted file paths, or an error if extration fails.
	Extract(ctx context.Context, archivePath string, destDir string, password string) ([]string, error)

	// CanExtract checks if this extractor can handle the given file.
	CanExtract(filename string) (bool, error)

	// Returns the human-readable name of this extractor (e.g. "RAR", "ZIP")
	Name() string
}

Extractor defines the behavior for extracting compress archives

type Manager added in v0.4.0

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles multiple extractors and determines which to use

func NewManager added in v0.4.0

func NewManager() *Manager

NewManager creates a new extraction manager and initilizes available extractors

func (*Manager) AvailableExtractors added in v0.4.0

func (m *Manager) AvailableExtractors() []string

AvailableExtractors returns the names of available extractors

func (*Manager) DetectArchives added in v0.4.0

func (m *Manager) DetectArchives(tasks []*domain.DownloadFile) (map[*domain.DownloadFile]Extractor, error)

DetectArchives scans the completed tasks and returns archives that need extraction Returns a map of task -> extractor for each archive found

func (*Manager) HasExtractors added in v0.4.0

func (m *Manager) HasExtractors() bool

HasExtractors returns true if any extractors are available

type Processor added in v0.4.0

type Processor struct {
	// contains filtered or unexported fields
}

func New added in v0.4.0

func New(ctx *app.Context, w Closeable) *Processor

func (*Processor) Finalize added in v0.4.0

func (p *Processor) Finalize(ctx context.Context, tasks []*domain.DownloadFile) error

Finalize renames .part to final names

func (*Processor) PostProcess added in v0.4.0

func (p *Processor) PostProcess(ctx context.Context, tasks []*domain.DownloadFile) error

PostProcess handles the modular repair and extraction logic

func (*Processor) Prepare added in v0.4.0

func (p *Processor) Prepare(ctx context.Context, nzbModel *nzb.Model, nzbFilename string) (*domain.PreparationResult, error)

Prepare sanitizes names and creates sparse files. Returns our internal Tasks.

type Repairer added in v0.4.0

type Repairer interface {
	// Verify checks if the file in the directory are healthy.
	// Returns true if healthy, false if repair is needed.
	Verify(path string) (bool, error)

	// Repair attempts to fix the files using available parity volumes.
	Repair(path string) error
}

Repairer defines the behavior for verifying and fixing downloads

Jump to

Keyboard shortcuts

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