sonarrimport

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: 15 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 sonarrimport fetches data from a running Sonarr instance and creates matching records in Pilot's database using the existing service layer. It is used only for the one-time migration wizard in the UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryResult

type CategoryResult struct {
	Imported int `json:"imported"`
	Skipped  int `json:"skipped"`
	Failed   int `json:"failed"`
}

CategoryResult holds import statistics for a single category.

type Client

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

Client is an HTTP client for the Sonarr v3 API.

func NewClient

func NewClient(baseURL, apiKey string) *Client

NewClient creates a new Sonarr API client. baseURL should be the root URL of the Sonarr instance, e.g. "http://sonarr.local:8989".

func (*Client) GetDownloadClients

func (c *Client) GetDownloadClients(ctx context.Context) ([]sonarrDownloadClient, error)

func (*Client) GetIndexers

func (c *Client) GetIndexers(ctx context.Context) ([]sonarrIndexer, error)

func (*Client) GetQualityProfiles

func (c *Client) GetQualityProfiles(ctx context.Context) ([]sonarrProfile, error)

func (*Client) GetRootFolders

func (c *Client) GetRootFolders(ctx context.Context) ([]sonarrRootFolder, error)

func (*Client) GetSeries

func (c *Client) GetSeries(ctx context.Context) ([]sonarrSeries, error)

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context) (*sonarrStatus, error)

type ClientPreview

type ClientPreview struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Kind string `json:"kind"`
}

ClientPreview is a summary of a Sonarr download client.

type FolderPreview

type FolderPreview struct {
	Path        string `json:"path"`
	FreeSpaceGB int    `json:"free_space_gb"`
}

FolderPreview is a summary of a Sonarr root folder.

type ImportOptions

type ImportOptions struct {
	QualityProfiles bool `json:"quality_profiles"`
	Libraries       bool `json:"libraries"`
	Indexers        bool `json:"indexers"`
	DownloadClients bool `json:"download_clients"`
	Series          bool `json:"series"`
}

ImportOptions controls which categories are imported.

type ImportResult

type ImportResult struct {
	QualityProfiles CategoryResult `json:"quality_profiles"`
	Libraries       CategoryResult `json:"libraries"`
	Indexers        CategoryResult `json:"indexers"`
	DownloadClients CategoryResult `json:"download_clients"`
	Series          CategoryResult `json:"series"`
	Errors          []string       `json:"errors"`
}

ImportResult reports how many records were created per category.

type IndexerPreview

type IndexerPreview struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Kind string `json:"kind"`
}

IndexerPreview is a summary of a Sonarr indexer.

type PreviewResult

type PreviewResult struct {
	Version         string           `json:"version"`
	SeriesCount     int              `json:"series_count"`
	QualityProfiles []ProfilePreview `json:"quality_profiles"`
	RootFolders     []FolderPreview  `json:"root_folders"`
	Indexers        []IndexerPreview `json:"indexers"`
	DownloadClients []ClientPreview  `json:"download_clients"`
}

PreviewResult summarises what would be imported from a Sonarr instance.

type ProfilePreview

type ProfilePreview struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

ProfilePreview is a summary of a Sonarr quality profile.

type Service

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

Service orchestrates the one-time import from a Sonarr instance.

func NewService

func NewService(
	shows *show.Service,
	qualities *quality.Service,
	libraries *library.Service,
	indexers *indexer.Service,
	downloaders *downloader.Service,
) *Service

NewService creates an import Service wired to the given core services.

func (*Service) Execute

func (s *Service) Execute(ctx context.Context, sonarrURL, apiKey string, opts ImportOptions) (*ImportResult, error)

Execute imports data from Sonarr into Pilot according to opts.

func (*Service) Preview

func (s *Service) Preview(ctx context.Context, sonarrURL, apiKey string) (*PreviewResult, error)

Preview connects to a Sonarr instance and returns a summary of what would be imported, without making any changes to the Pilot database.

Jump to

Keyboard shortcuts

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