decision

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: 2 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 decision holds the rules for whether a release is worth grabbing for an episode, given its quality profile and the file the episode already has. Automatic search and RSS sync share these rules so they can't drift apart.

Index

Constants

View Source
const (
	// ReasonBelowProfile: the profile doesn't accept this quality (not in
	// its allowed list, or below its cutoff resolution when it has none).
	// The string is kept for the UI's filtered-rows display.
	ReasonBelowProfile     = "below_quality_profile"
	ReasonNotAnUpgrade     = "not_an_upgrade"
	ReasonUpgradesDisabled = "upgrades_disabled"
	ReasonUpgradeLimit     = "upgrade_until_reached"
	ReasonCurrentUnknown   = "current_quality_unknown"
)

Rejection reasons, stable strings suitable for logs and API responses.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(candidate plugin.Quality, current *plugin.Quality, p *quality.Profile) (bool, string)

Evaluate decides whether to grab a release of quality candidate for an episode whose current file has quality current (nil when the episode has no file). It returns ok=true, or ok=false with a reason.

Rules, in order:

  1. The candidate must meet the profile minimum.
  2. No current file: grab.
  3. Current quality unknown (e.g. imported before quality was tracked): don't upgrade automatically; a manual search still can.
  4. Same quality (resolution + source; codec doesn't matter, as in Sonarr), higher revision (PROPER/REPACK): grab. A proper fixes a broken release of the quality you already chose, so it is taken even when the cutoff is met or upgrades are off, as Sonarr's default "prefer and upgrade" does.
  5. Not strictly better than the current file: reject.
  6. Current file below the cutoff: grab.
  7. Cutoff met: grab only if the profile allows upgrades and the current file is below its upgrade-until ceiling.

func MeetsProfileMinimum

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

MeetsProfileMinimum reports whether q is acceptable for profile p at all.

When the profile lists allowed qualities, q must be one of them (resolution + source, see quality.Profile.Allows). That's how a "Bluray only" profile rejects WEB-DL, and how a profile accepts WEBRip as a fallback by listing it.

A profile with no list falls back to the cutoff's resolution as a floor. A nil profile, or one with neither a list nor a cutoff, accepts everything.

Types

This section is empty.

Jump to

Keyboard shortcuts

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