releaseprofile

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: 10 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 releaseprofile implements release profiles: per-indexer (or global) lists of terms a release title must contain or must not contain, as in Sonarr.

A term is a case-insensitive substring, or a regular expression when written as /pattern/ (also case-insensitive). A release passes a profile when it contains at least one required term (if the profile has any) and none of the ignored terms. Every enabled profile that applies to the release's indexer must pass.

Index

Constants

View Source
const FilterReason = "release_profile"

FilterReason is the search-result filter reason for a release rejected by a release profile.

Variables

View Source
var ErrNotFound = errors.New("release profile not found")

ErrNotFound is returned when a profile ID doesn't exist.

Functions

This section is empty.

Types

type Matcher

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

Matcher checks release titles against a set of profiles. A nil Matcher accepts everything.

func LoadMatcher

func LoadMatcher(ctx context.Context, q db.Querier) (*Matcher, error)

LoadMatcher compiles the enabled profiles stored in q.

func NewMatcher

func NewMatcher(profiles []Profile) *Matcher

NewMatcher compiles profiles. Disabled profiles are skipped, and so is any term that fails to compile (Create/Update reject those, so this only guards against rows edited outside Pilot).

func (*Matcher) Check

func (m *Matcher) Check(title, indexerID string) (ok bool, reason string)

Check reports whether a release with this title from this indexer passes every applicable profile. When it doesn't, reason says which profile rejected it and why.

type Profile

type Profile struct {
	ID        string
	Name      string
	Enabled   bool
	Required  []string
	Ignored   []string
	IndexerID string // "" = all indexers
	CreatedAt string
	UpdatedAt string
}

Profile is a release profile.

type Request

type Request struct {
	Name      string
	Enabled   bool
	Required  []string
	Ignored   []string
	IndexerID string
}

Request is the editable part of a profile.

type Service

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

Service stores release profiles.

func NewService

func NewService(q db.Querier) *Service

NewService creates a Service.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req Request) (Profile, error)

Create validates and stores a new profile.

func (*Service) Delete

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

Delete removes a profile.

func (*Service) Get

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

Get returns one profile.

func (*Service) List

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

List returns every profile, by name.

func (*Service) Matcher

func (s *Service) Matcher(ctx context.Context) (*Matcher, error)

Matcher compiles every enabled profile into a Matcher.

func (*Service) Update

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

Update validates and replaces a profile's settings.

type ValidationError

type ValidationError struct{ Msg string }

ValidationError explains why a Request was rejected.

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