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
- Variables
- type Matcher
- type Profile
- type Request
- type Service
- func (s *Service) Create(ctx context.Context, req Request) (Profile, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (Profile, error)
- func (s *Service) List(ctx context.Context) ([]Profile, error)
- func (s *Service) Matcher(ctx context.Context) (*Matcher, error)
- func (s *Service) Update(ctx context.Context, id string, req Request) (Profile, error)
- type ValidationError
Constants ¶
const FilterReason = "release_profile"
FilterReason is the search-result filter reason for a release rejected by a release profile.
Variables ¶
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 ¶
LoadMatcher compiles the enabled profiles stored in q.
func NewMatcher ¶
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).
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.
type ValidationError ¶
type ValidationError struct{ Msg string }
ValidationError explains why a Request was rejected.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string