delay

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: 9 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 delay implements the delay profile (as in Sonarr): which download protocols are used, which is preferred, and how long to wait after a release is published before grabbing it automatically, so a better release has time to show up.

The delay applies to automatic grabs from RSS sync. A release still inside its delay is stored as pending and grabbed later if it is still the best wanted release. Searches the user triggers are not delayed.

Index

Constants

View Source
const MaxDelayMinutes = 7 * 24 * 60

MaxDelayMinutes caps a delay at one week.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	UsenetEnabled  bool `json:"usenet_enabled"`
	TorrentEnabled bool `json:"torrent_enabled"`
	// PreferredProtocol is "usenet" or "torrent". It breaks ties between
	// releases of equal quality and revision.
	PreferredProtocol   string `json:"preferred_protocol"`
	UsenetDelayMinutes  int    `json:"usenet_delay_minutes"`
	TorrentDelayMinutes int    `json:"torrent_delay_minutes"`
	// BypassIfHighestQuality grabs immediately when the release is the
	// best quality the series' profile allows.
	BypassIfHighestQuality bool `json:"bypass_if_highest_quality"`
}

Profile is the delay profile.

func Default

func Default() Profile

Default is the profile used until one is saved: both protocols, prefer usenet, no delay. With no delay, behavior is the same as before delay profiles existed.

func (Profile) Allows

func (p Profile) Allows(proto plugin.Protocol) bool

Allows reports whether releases of this protocol may be grabbed.

func (Profile) Bypasses

func (p Profile) Bypasses(q plugin.Quality, prof *quality.Profile) bool

Bypasses reports whether a release of quality q skips the delay: the option is on and q is the best quality the profile allows (resolution and source; the cutoff when the profile lists no qualities).

func (Profile) Delay

func (p Profile) Delay(proto plugin.Protocol) time.Duration

Delay is how long to wait after publication for this protocol.

func (Profile) EligibleAt

func (p Profile) EligibleAt(proto plugin.Protocol, ageDays float64, now time.Time) time.Time

EligibleAt is when a release published ageDays ago (as of now) may be grabbed: its publish time plus the delay for its protocol.

func (Profile) Preferred

func (p Profile) Preferred(proto plugin.Protocol) bool

Preferred reports whether proto is the preferred protocol.

func (Profile) Validate

func (p Profile) Validate() error

Validate checks p.

type Store

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

Store loads and saves the profile in the settings table.

func NewStore

func NewStore(q db.Querier) *Store

NewStore creates a Store.

func (*Store) Get

func (s *Store) Get(ctx context.Context) (Profile, error)

Get returns the saved profile, or Default() when none is saved.

func (*Store) Set

func (s *Store) Set(ctx context.Context, p Profile) error

Set validates and saves p.

type ValidationError

type ValidationError struct{ Msg string }

ValidationError explains why a profile can't be saved.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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