engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryable

func IsRetryable(err error) bool

Types

type Engine

type Engine struct {
	OutputDir     string
	Concurrency   int
	ResolveDelay  time.Duration
	DownloadDelay time.Duration
	Retry         RetryPolicy
	Progress      ProgressReporter
	HTTPClient    *http.Client
	NoResume      bool
}

func (*Engine) Download

func (e *Engine) Download(ctx context.Context, s site.Site, album *site.Album) error

type HTTPError

type HTTPError struct {
	StatusCode int
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type NoopReporter

type NoopReporter struct{}

func (NoopReporter) OnAlbumComplete

func (NoopReporter) OnAlbumComplete(site.Album, int, int)

func (NoopReporter) OnFileComplete

func (NoopReporter) OnFileComplete(site.File, error)

func (NoopReporter) OnFileProgress

func (NoopReporter) OnFileProgress(site.File, int64, int64)

func (NoopReporter) OnFileStart

func (NoopReporter) OnFileStart(site.File)

type ProgressReporter

type ProgressReporter interface {
	OnFileStart(file site.File)
	OnFileProgress(file site.File, bytesDownloaded, totalBytes int64)
	OnFileComplete(file site.File, err error)
	OnAlbumComplete(album site.Album, succeeded, failed int)
}

type RetryPolicy

type RetryPolicy struct {
	MaxRetries int
	BaseDelay  time.Duration
}

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

func (RetryPolicy) Do

func (rp RetryPolicy) Do(ctx context.Context, fn func() error) error

Jump to

Keyboard shortcuts

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