downloader

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package downloader manages download client configurations and orchestrates adding releases to the appropriate download client.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCompatibleClient = errors.New("no enabled download client configured for this protocol")

ErrNoCompatibleClient is returned when no enabled client supports the release protocol.

View Source
var ErrNotFound = errors.New("download client not found")

ErrNotFound is returned when a download client config does not exist.

Functions

This section is empty.

Types

type Config

type Config struct {
	ID        string
	Name      string
	Kind      string // "qbittorrent", "transmission", etc.
	Enabled   bool
	Priority  int
	Settings  json.RawMessage
	CreatedAt time.Time
	UpdatedAt time.Time
}

Config is the domain representation of a stored download client configuration.

type CreateRequest

type CreateRequest struct {
	Name     string
	Kind     string
	Enabled  bool
	Priority int
	Settings json.RawMessage
}

CreateRequest carries the fields needed to create a download client config.

type Service

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

Service manages download client configuration and release submission.

func NewService

func NewService(q db.Querier, reg *registry.Registry, bus *events.Bus) *Service

NewService creates a new Service.

func (*Service) Add

func (s *Service) Add(ctx context.Context, r plugin.Release, allowedIDs []string) (downloadClientID, clientItemID string, err error)

Add finds the first enabled download client that supports the release's protocol and submits the release. Returns the download client config ID and the client-assigned item ID.

func (*Service) ClientFor

func (s *Service) ClientFor(ctx context.Context, configID string) (plugin.DownloadClient, error)

ClientFor returns a (cached) plugin.DownloadClient for the given config ID. Used by the queue service to communicate with a specific client.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req CreateRequest) (Config, error)

Create persists a new download client configuration.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

Delete removes a download client config. Returns ErrNotFound if absent.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Config, error)

Get returns a download client config by ID. Returns ErrNotFound if absent.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Config, error)

List returns all download client configs ordered by priority then name.

func (*Service) Test

func (s *Service) Test(ctx context.Context, id string) error

Test instantiates the plugin and verifies connectivity to the download client.

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Config, error)

Update replaces the mutable fields of a download client config. Returns ErrNotFound if the config does not exist.

type UpdateRequest

type UpdateRequest = CreateRequest

UpdateRequest carries the fields needed to update a download client config.

Jump to

Keyboard shortcuts

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