arrs

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPathMatchFailed         = model.ErrPathMatchFailed
	ErrEpisodeAlreadySatisfied = model.ErrEpisodeAlreadySatisfied
	ErrInstanceNotFound        = model.ErrInstanceNotFound
)

Functions

func IsTemporarilyUnreachable added in v0.3.0

func IsTemporarilyUnreachable(err error) bool

IsTemporarilyUnreachable reports whether err indicates the *arr was only temporarily unreachable — a network/transport failure (timeout, connection refused, DNS, TLS, etc.) or a 5xx server response — rather than a definitive answer about the release. Such errors must DEFER a repair (keep the file repair-pending so it self-heals when the *arr returns) instead of condemning the file as corrupted. starr surfaces non-2xx responses as a *starr.ReqError whose Code carries the HTTP status; transport failures surface as net.Error (often wrapped in *url.Error) or a context deadline.

Types

type ConfigInstance

type ConfigInstance = model.ConfigInstance

Re-export types for backward compatibility

type ConfigManager

type ConfigManager = model.ConfigManager

type Service

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

Service manages Radarr, Sonarr, Lidarr, Readarr, and Whisparr instances for health monitoring and file repair

func NewService

func NewService(configGetter config.ConfigGetter, configManager model.ConfigManager, userRepo *database.UserRepository, queueRepo *database.Repository) *Service

NewService creates a new arrs service for health monitoring and file repair

func (*Service) ClearInstanceCache added in v0.3.0

func (s *Service) ClearInstanceCache(ctx context.Context, instanceName string)

ClearInstanceCache clears all movie and series caches for a specific instance

func (*Service) DiscoverFileMetadata added in v0.3.0

func (s *Service) DiscoverFileMetadata(ctx context.Context, filePath, relativePath, nzbName, libraryPath string) (*model.WebhookMetadata, error)

DiscoverFileMetadata attempts to discover the rich metadata for a file through the appropriate ARR instance

func (*Service) EnsureDownloadClientRegistration

func (s *Service) EnsureDownloadClientRegistration(ctx context.Context, altmountHost string, altmountPort int, urlBase string, apiKey string) error

EnsureDownloadClientRegistration ensures that AltMount is registered as a SABnzbd download client in all enabled ARR instances

func (*Service) EnsureWebhookRegistration

func (s *Service) EnsureWebhookRegistration(ctx context.Context, altmountURL string, apiKey string) error

EnsureWebhookRegistration ensures that the AltMount webhook is registered in all enabled ARR instances

func (*Service) GetAllInstances

func (s *Service) GetAllInstances() []*model.ConfigInstance

GetAllInstances returns all arrs instances from configuration

func (*Service) GetFirstAdminAPIKey

func (s *Service) GetFirstAdminAPIKey(ctx context.Context) string

GetFirstAdminAPIKey retrieves the API key of the first admin user

func (*Service) GetHealth

func (s *Service) GetHealth(ctx context.Context) (map[string]any, error)

GetHealth retrieves health checks from all enabled ARR instances

func (*Service) GetInstance

func (s *Service) GetInstance(instanceType, instanceName string) *model.ConfigInstance

GetInstance returns a specific instance by type and name

func (*Service) NoteImportFailure added in v0.3.0

func (s *Service) NoteImportFailure(ctx context.Context, downloadID, category string)

NoteImportFailure runs the importer-side failure breaker for a permanently failed *arr-originated download: counts the failure per target against the shared tracker and, at the queue_cleanup_max_failures threshold, unmonitors the target and removes the *arr queue record with blocklist-without-re-search (before the *arr's own failed-download handling can auto-re-search). See worker.HandleImportFailure.

func (*Service) RegisterConfigChangeHandler added in v0.3.0

func (s *Service) RegisterConfigChangeHandler(ctx context.Context, configManager *config.Manager)

RegisterConfigChangeHandler subscribes to config changes and starts/stops the queue cleanup worker when arrs.enabled or arrs.queue_cleanup_enabled flips.

func (*Service) RegisterInstance

func (s *Service) RegisterInstance(ctx context.Context, arrURL, apiKey string) error

RegisterInstance attempts to automatically register an ARR instance

func (*Service) ResolveIndexerByDownloadID added in v0.3.0

func (s *Service) ResolveIndexerByDownloadID(ctx context.Context, downloadID string) (string, bool)

ResolveIndexerByDownloadID looks up which indexer a download came from by querying the native queue of each configured Sportarr instance for the given download-client ID. Sportarr is not starr-compatible and never fires an OnGrab webhook, so this on-demand lookup (used at import time) is how its imports get attributed instead of falling back to "Unknown" in indexer health. Only Sportarr instances are queried — the other *arrs supply the indexer via webhook. Returns ("", false) when no Sportarr instance knows the ID.

func (*Service) StartWorker

func (s *Service) StartWorker(ctx context.Context) error

StartWorker starts the queue cleanup worker

func (*Service) StopWorker

func (s *Service) StopWorker(ctx context.Context)

StopWorker stops the queue cleanup worker

func (*Service) TestConnection

func (s *Service) TestConnection(ctx context.Context, instanceType, url, apiKey string) error

TestConnection tests the connection to an arrs instance

func (*Service) TestDownloadClientRegistration

func (s *Service) TestDownloadClientRegistration(ctx context.Context, altmountHost string, altmountPort int, urlBase string, apiKey string) (map[string]string, error)

TestDownloadClientRegistration tests the connection from ARR instances back to AltMount

func (*Service) TriggerDownloadScan

func (s *Service) TriggerDownloadScan(ctx context.Context, instanceType string)

TriggerDownloadScan triggers the "Check For Finished Downloads" task in ARR instances

func (*Service) TriggerFileRescan

func (s *Service) TriggerFileRescan(ctx context.Context, pathForRescan string, relativePath string, metadataStr *string) error

TriggerFileRescan triggers a rescan for a specific file path through the appropriate ARR instance

func (*Service) TriggerScanForFile

func (s *Service) TriggerScanForFile(ctx context.Context, filePath string) error

TriggerScanForFile finds the ARR instance managing the file and triggers a download scan on it.

Directories

Path Synopsis
Package failures holds the in-memory per-target failure counts behind the arrs circuit breaker (arrs.queue_cleanup_max_failures).
Package failures holds the in-memory per-target failure counts behind the arrs circuit breaker (arrs.queue_cleanup_max_failures).

Jump to

Keyboard shortcuts

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