arr

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package arr provides HTTP clients for the services in an *arr media stack.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SonarrSpec describes Sonarr's v3 API.
	SonarrSpec = ServiceSpec{Name: "sonarr", BasePath: "/api/v3", StatusPath: "/system/status", Auth: AuthHeaderKey}
	// RadarrSpec describes Radarr's v3 API.
	RadarrSpec = ServiceSpec{Name: "radarr", BasePath: "/api/v3", StatusPath: "/system/status", Auth: AuthHeaderKey}
	// ProwlarrSpec describes Prowlarr's v1 API, which differs from Sonarr/Radarr.
	ProwlarrSpec = ServiceSpec{Name: "prowlarr", BasePath: "/api/v1", StatusPath: "/system/status", Auth: AuthHeaderKey}
	// BazarrSpec describes Bazarr, which serves /api rather than a versioned
	// path. It accepts the canonical X-Api-Key header, so no override is needed.
	BazarrSpec = ServiceSpec{
		Name: "bazarr", BasePath: "/api", StatusPath: "/system/status",
		Auth: AuthHeaderKey,
	}
	// QBittorrentSpec describes qBittorrent's WebUI API v2, which issues a
	// session cookie from a form login instead of accepting an API key.
	QBittorrentSpec = ServiceSpec{Name: "qbittorrent", BasePath: "/api/v2", StatusPath: "/app/version", Auth: AuthSession}
	// NZBGetSpec describes NZBGet's JSON-RPC endpoint. The base path is empty
	// because every call goes to /jsonrpc, which doubles as the status path
	// when suffixed with a method name.
	NZBGetSpec = ServiceSpec{Name: "nzbget", BasePath: "", StatusPath: "/jsonrpc/version", Auth: AuthBasic}
)

Specs for the services this build supports.

Functions

func BazarrBlacklistEpisodeSubtitle added in v1.1.0

func BazarrBlacklistEpisodeSubtitle(ctx context.Context, c *Client, seriesID, episodeID int,
	provider, subsID, language, subtitlesPath string) error

BazarrBlacklistEpisodeSubtitle blacklists one episode subtitle. Bazarr also deletes the subtitle file and starts a replacement search.

func BazarrBlacklistMovieSubtitle added in v1.1.0

func BazarrBlacklistMovieSubtitle(ctx context.Context, c *Client, radarrID int,
	provider, subsID, language, subtitlesPath string) error

BazarrBlacklistMovieSubtitle blacklists one movie subtitle. Bazarr also deletes the subtitle file and starts a replacement search.

func BazarrDeleteBlacklistItem added in v1.1.0

func BazarrDeleteBlacklistItem(ctx context.Context, c *Client, kind, provider, subsID string, all bool) error

BazarrDeleteBlacklistItem removes one blacklist entry, or empties the list when all is true. Bazarr compares the all parameter to the lowercase literal "true", so it is the one flag that must not be capitalised.

func BazarrDeleteEpisodeSubtitle added in v0.3.0

func BazarrDeleteEpisodeSubtitle(ctx context.Context, c *Client, seriesID, episodeID int, language, path string, forced, hi bool) error

BazarrDeleteEpisodeSubtitle removes a downloaded subtitle file for an episode.

func BazarrDeleteMovieSubtitle added in v0.3.0

func BazarrDeleteMovieSubtitle(ctx context.Context, c *Client, radarrID int, language, path string, forced, hi bool) error

BazarrDeleteMovieSubtitle removes a downloaded subtitle file for a movie.

func BazarrDownloadEpisodeSubtitle added in v1.1.0

func BazarrDownloadEpisodeSubtitle(ctx context.Context, c *Client, seriesID, episodeID int,
	provider, subtitle string, hi, forced, originalFormat bool) error

BazarrDownloadEpisodeSubtitle downloads one specific search result. Both provider and subtitle must come from BazarrManualSearchEpisode: the token is opaque and only that provider can resolve it.

func BazarrDownloadMovieSubtitle added in v1.1.0

func BazarrDownloadMovieSubtitle(ctx context.Context, c *Client, radarrID int,
	provider, subtitle string, hi, forced, originalFormat bool) error

BazarrDownloadMovieSubtitle downloads one specific search result for a movie. Both provider and subtitle must come from BazarrManualSearchMovie.

func BazarrModifySubtitle added in v1.1.0

func BazarrModifySubtitle(ctx context.Context, c *Client, mod SubtitleMod) error

BazarrModifySubtitle applies a mod, a sync or a translation to an existing subtitle file, in place. Syncing and translating are slow enough to need the long timeout.

func BazarrMovieAction added in v1.1.0

func BazarrMovieAction(ctx context.Context, c *Client, radarrID int, action string) error

BazarrMovieAction runs scan-disk, search-missing or search-wanted against one movie.

func BazarrResetProviders added in v1.1.0

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

BazarrResetProviders clears the throttling state of every provider, so providers disabled by an error are retried immediately.

func BazarrRunTask added in v1.1.0

func BazarrRunTask(ctx context.Context, c *Client, taskID string) error

BazarrRunTask runs one scheduled job now. The id is a job_id from BazarrTasks; Bazarr ignores an unknown one rather than reporting it.

func BazarrSearchEpisodeSubtitles added in v0.3.0

func BazarrSearchEpisodeSubtitles(ctx context.Context, c *Client, seriesID, episodeID int, language string, forced, hi bool) error

BazarrSearchEpisodeSubtitles asks Bazarr to find and download a subtitle for one episode in the given language.

func BazarrSearchMovieSubtitles added in v0.3.0

func BazarrSearchMovieSubtitles(ctx context.Context, c *Client, radarrID int, language string, forced, hi bool) error

BazarrSearchMovieSubtitles asks Bazarr to find and download a subtitle for one movie in the given language.

func BazarrSeriesAction added in v1.1.0

func BazarrSeriesAction(ctx context.Context, c *Client, seriesID int, action string) error

BazarrSeriesAction runs scan-disk, search-missing or search-wanted against one series.

func BazarrSetMovieProfile added in v1.1.0

func BazarrSetMovieProfile(ctx context.Context, c *Client, radarrIDs []int, profileID int) error

BazarrSetMovieProfile assigns a languages profile to each movie. A profileID of 0 unassigns it.

func BazarrSetSeriesProfile added in v1.1.0

func BazarrSetSeriesProfile(ctx context.Context, c *Client, seriesIDs []int, profileID int) error

BazarrSetSeriesProfile assigns a languages profile to each series. A profileID of 0 unassigns it, which stops Bazarr fetching subtitles at all.

func BazarrStatus added in v0.3.0

func BazarrStatus(ctx context.Context, c *Client) (map[string]any, error)

BazarrStatus returns version and environment information.

func DeleteBlocklistItem added in v0.3.0

func DeleteBlocklistItem(ctx context.Context, c *Client, id int) error

DeleteBlocklistItem removes one release from the blocklist, letting the service grab it again.

func DeleteCustomFormat added in v1.4.0

func DeleteCustomFormat(ctx context.Context, c *Client, id int) error

DeleteCustomFormat removes a custom format. Every quality profile scoring it loses that score.

func DeleteProvider added in v1.3.0

func DeleteProvider(ctx context.Context, c *Client, kind string, id int) error

DeleteProvider removes one provider. Its configuration, including whatever credentials it held, is not recoverable.

func DeleteQualityProfile added in v1.4.0

func DeleteQualityProfile(ctx context.Context, c *Client, id int) error

DeleteQualityProfile removes a quality profile. A profile still in use is refused by the service, and that refusal is returned rather than hidden.

func DeleteQueueItem

func DeleteQueueItem(ctx context.Context, c *Client, id int, removeFromClient, blocklist bool) error

DeleteQueueItem removes a download from the queue, optionally telling the download client to drop it and blocklisting the release.

func DeleteQueueItems added in v1.2.0

func DeleteQueueItems(ctx context.Context, c *Client, ids []int, removeFromClient, blocklist bool) (int, error)

DeleteQueueItems removes several downloads from the queue in one call and reports how many were removed.

The bulk route takes the ids in a request body and the flags in the query string, which is why this reaches past the Delete helper.

func DeleteReleaseProfile added in v1.4.0

func DeleteReleaseProfile(ctx context.Context, c *Client, id int) error

DeleteReleaseProfile removes a release profile, so its terms stop filtering releases.

func DeleteRootFolder added in v1.4.0

func DeleteRootFolder(ctx context.Context, c *Client, id int) error

DeleteRootFolder unregisters a library path. The files on disk are untouched; what the service already imported from the folder stays in the library.

func DeleteTag added in v0.3.0

func DeleteTag(ctx context.Context, c *Client, id int) error

DeleteTag removes a tag, detaching it from everything that carried it.

func GetJSON

func GetJSON[T any](ctx context.Context, c *Client, path string, q ...Query) (T, error)

GetJSON performs a GET and decodes the response into out.

func GrabQueueItem added in v1.2.0

func GrabQueueItem(ctx context.Context, c *Client, id int) error

GrabQueueItem forces a pending queue item to be grabbed now, which is how a release held by a delay profile is released early.

func GrabRelease added in v1.2.0

func GrabRelease(ctx context.Context, c *Client, guid string, indexerID int) error

GrabRelease sends one release to a download client, bypassing the rejections an automatic search would have honoured.

func MarkHistoryFailed added in v1.2.0

func MarkHistoryFailed(ctx context.Context, c *Client, id int) error

MarkHistoryFailed marks a past grab as failed, which blocklists the release and lets the service search for a replacement.

func NZBGetAppend added in v1.1.0

func NZBGetAppend(ctx context.Context, c *Client, req AppendNZBRequest) (int, error)

NZBGetAppend adds an nzb by URL or base64 content and returns its NZBID. The append method is positional; the trailing empty array is PPParameters, which NZBGet requires even when there are none.

func NZBGetEditQueue added in v1.1.0

func NZBGetEditQueue(ctx context.Context, c *Client, command, param string, ids []int) error

NZBGetEditQueue runs one editqueue command against queue or history entries. NZBGet answers false rather than an error when nothing matched, so that is turned into an error naming the command and ids.

func NZBGetRate added in v1.1.0

func NZBGetRate(ctx context.Context, c *Client, limitKB int) error

NZBGetRate sets the download speed limit in KiB/s; 0 removes the limit.

func NZBGetScan added in v1.1.0

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

NZBGetScan asks NZBGet to scan its incoming nzb directory now.

func NZBGetSetPaused added in v1.1.0

func NZBGetSetPaused(ctx context.Context, c *Client, scope string, paused bool) error

NZBGetSetPaused pauses or resumes one of NZBGet's three independent queues: download, post (post-processing) or scan (the incoming nzb directory).

func NZBGetVersion added in v1.1.0

func NZBGetVersion(ctx context.Context, c *Client) (string, error)

NZBGetVersion returns the server version string.

func ProwlarrDeleteIndexer added in v1.1.0

func ProwlarrDeleteIndexer(ctx context.Context, c *Client, id int) error

ProwlarrDeleteIndexer removes an indexer and unsyncs it from every connected application. This cannot be undone.

func ProwlarrGrabRelease added in v1.1.0

func ProwlarrGrabRelease(ctx context.Context, c *Client, guid string, indexerID int) error

ProwlarrGrabRelease sends a release from prowlarr_search to the download client the indexer is configured with.

func QBittorrentAddTags added in v1.1.0

func QBittorrentAddTags(ctx context.Context, c *Client, hashes, tags []string) error

QBittorrentAddTags applies tags to torrents, creating any that do not exist.

func QBittorrentAddTorrent added in v1.1.0

func QBittorrentAddTorrent(ctx context.Context, c *Client, req AddTorrentRequest) error

QBittorrentAddTorrent adds torrents by http, https or magnet URL. qBittorrent answers 200 for every outcome and reports failure only through the body.

func QBittorrentCreateCategory added in v1.1.0

func QBittorrentCreateCategory(ctx context.Context, c *Client, name, savePath string) error

QBittorrentCreateCategory creates a category with an optional save path.

func QBittorrentDeleteTorrents added in v1.1.0

func QBittorrentDeleteTorrents(ctx context.Context, c *Client, hashes []string, deleteFiles bool) error

QBittorrentDeleteTorrents removes torrents, optionally deleting their files.

func QBittorrentEditCategory added in v1.1.0

func QBittorrentEditCategory(ctx context.Context, c *Client, name, savePath string) error

QBittorrentEditCategory changes a category's save path.

func QBittorrentListTags added in v1.1.0

func QBittorrentListTags(ctx context.Context, c *Client) ([]string, error)

QBittorrentListTags lists every tag known to the instance.

func QBittorrentRecheckTorrents added in v1.1.0

func QBittorrentRecheckTorrents(ctx context.Context, c *Client, hashes []string) error

QBittorrentRecheckTorrents re-verifies torrent data on disk.

func QBittorrentRemoveCategories added in v1.1.0

func QBittorrentRemoveCategories(ctx context.Context, c *Client, names []string) error

QBittorrentRemoveCategories deletes categories; torrents in them become uncategorised. Names are newline-separated on the wire.

func QBittorrentRemoveTags added in v1.1.0

func QBittorrentRemoveTags(ctx context.Context, c *Client, hashes, tags []string) error

QBittorrentRemoveTags strips tags from torrents; no tags means all of them.

func QBittorrentRenameTorrent added in v1.1.0

func QBittorrentRenameTorrent(ctx context.Context, c *Client, hash, name string) error

QBittorrentRenameTorrent changes a torrent's display name.

func QBittorrentSetCategory added in v1.1.0

func QBittorrentSetCategory(ctx context.Context, c *Client, hashes []string, category string) error

QBittorrentSetCategory assigns a category; an empty name clears it.

func QBittorrentSetLocation added in v1.1.0

func QBittorrentSetLocation(ctx context.Context, c *Client, hashes []string, location string) error

QBittorrentSetLocation moves torrents' data to a new directory.

func QBittorrentSetPriority added in v1.1.0

func QBittorrentSetPriority(ctx context.Context, c *Client, hashes []string, position string) error

QBittorrentSetPriority moves torrents in the download queue. qBittorrent answers 409 when queueing is disabled, which surfaces as the client error.

func QBittorrentSetTorrentLimits added in v1.1.0

func QBittorrentSetTorrentLimits(ctx context.Context, c *Client, hashes []string, dl, up *int64, share *ShareLimits) error

QBittorrentSetTorrentLimits sets per-torrent speed and share limits, calling only the endpoints whose inputs were given.

func QBittorrentStartTorrents added in v1.1.0

func QBittorrentStartTorrents(ctx context.Context, c *Client, hashes []string) error

QBittorrentStartTorrents starts (resumes) torrents.

func QBittorrentStopTorrents added in v1.1.0

func QBittorrentStopTorrents(ctx context.Context, c *Client, hashes []string) error

QBittorrentStopTorrents stops (pauses) torrents.

func RadarrDeleteMovie

func RadarrDeleteMovie(ctx context.Context, c *Client, id int, deleteFiles bool) error

RadarrDeleteMovie removes a movie, optionally deleting its files.

func RadarrDeleteMovieFiles added in v0.3.0

func RadarrDeleteMovieFiles(ctx context.Context, c *Client, ids []int) (int, error)

RadarrDeleteMovieFiles deletes movie files from disk and returns how many were removed. This cannot be undone.

func SonarrDeleteEpisodeFiles added in v0.3.0

func SonarrDeleteEpisodeFiles(ctx context.Context, c *Client, ids []int) (int, error)

SonarrDeleteEpisodeFiles deletes episode files from disk and returns how many were removed. This cannot be undone.

func SonarrDeleteSeries

func SonarrDeleteSeries(ctx context.Context, c *Client, id int, deleteFiles bool) error

SonarrDeleteSeries removes a series, optionally deleting its files.

func SonarrMonitorEpisodes added in v0.3.0

func SonarrMonitorEpisodes(ctx context.Context, c *Client, episodeIDs []int, monitored bool) error

SonarrMonitorEpisodes monitors or unmonitors specific episodes.

Types

type AddMovieRequest

type AddMovieRequest struct {
	TMDBID              int    `json:"tmdbId"`
	Title               string `json:"title"`
	QualityProfileID    int    `json:"qualityProfileId"`
	RootFolderPath      string `json:"rootFolderPath"`
	Monitored           bool   `json:"monitored"`
	MinimumAvailability string `json:"minimumAvailability,omitempty"`
	Tags                []int  `json:"tags,omitempty"`
	AddOptions          struct {
		SearchForMovie bool `json:"searchForMovie"`
	} `json:"addOptions"`
}

AddMovieRequest describes a movie to add to a Radarr library.

type AddSeriesRequest

type AddSeriesRequest struct {
	TVDBID           int    `json:"tvdbId"`
	Title            string `json:"title"`
	QualityProfileID int    `json:"qualityProfileId"`
	RootFolderPath   string `json:"rootFolderPath"`
	Monitored        bool   `json:"monitored"`
	SeasonFolder     *bool  `json:"seasonFolder,omitempty"`
	SeriesType       string `json:"seriesType,omitempty" jsonschema:"standard, daily or anime"`
	Tags             []int  `json:"tags,omitempty"`
	AddOptions       struct {
		SearchForMissingEpisodes bool `json:"searchForMissingEpisodes"`
		// Monitor selects which episodes to monitor on add: all, future,
		// missing, existing, firstSeason, lastSeason or none.
		Monitor string `json:"monitor,omitempty"`
	} `json:"addOptions"`
}

AddSeriesRequest describes a series to add to a Sonarr library. SeasonFolder is a pointer so that omitting it leaves the service's own default in place rather than forcing a flat folder layout.

type AddTorrentRequest added in v1.1.0

type AddTorrentRequest struct {
	URLs             []string
	SavePath         string
	Category         string
	Tags             []string
	Stopped          bool
	Rename           string
	DownloadLimit    *int64
	UploadLimit      *int64
	RatioLimit       *float64
	SeedingTimeLimit *int
	AutoTMM          *bool
}

AddTorrentRequest describes torrents to add by URL.

type AppProfile added in v1.1.0

type AppProfile struct {
	ID                      int    `json:"id"`
	Name                    string `json:"name"`
	EnableRSS               bool   `json:"enableRss"`
	EnableAutomaticSearch   bool   `json:"enableAutomaticSearch"`
	EnableInteractiveSearch bool   `json:"enableInteractiveSearch"`
	MinimumSeeders          int    `json:"minimumSeeders,omitempty"`
}

AppProfile is a sync profile controlling how indexers behave in the apps Prowlarr pushes them to.

func ProwlarrListAppProfiles added in v1.1.0

func ProwlarrListAppProfiles(ctx context.Context, c *Client) ([]AppProfile, error)

ProwlarrListAppProfiles returns the sync profiles indexers can be assigned to.

type AppendNZBRequest added in v1.1.0

type AppendNZBRequest struct {
	Filename  string
	URL       string
	Content   string
	Category  string
	Priority  int
	AddToTop  bool
	AddPaused bool
	DupeKey   string
	DupeScore int
	DupeMode  string
}

AppendNZBRequest describes an nzb to add. Exactly one of URL and Content is set: NZBGet takes either in the same positional slot and tells them apart itself.

type Application added in v1.1.0

type Application struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Implementation string `json:"implementation,omitempty" jsonschema:"Sonarr, Radarr, Lidarr and so on"`
	SyncLevel      string `json:"syncLevel,omitempty" jsonschema:"fullSync, addOnly or disabled"`
	Tags           []int  `json:"tags,omitempty"`
}

Application is an *arr instance Prowlarr syncs indexers to. Its own fields array holds that instance's API key and is deliberately not decoded.

func ProwlarrListApplications added in v1.1.0

func ProwlarrListApplications(ctx context.Context, c *Client) ([]Application, error)

ProwlarrListApplications returns the *arr instances Prowlarr syncs to.

type AudioTrack added in v1.1.0

type AudioTrack struct {
	Stream   string `json:"stream" jsonschema:"track reference, e.g. a:0"`
	Name     string `json:"name,omitempty"`
	Language string `json:"language,omitempty"`
}

AudioTrack is one audio stream in a media file. Stream is the ffmpeg-style index a subtitle sync can use as its reference.

type AuthKind

type AuthKind int

AuthKind selects how credentials are attached to outbound requests.

const (
	// AuthHeaderKey sends the API key in a service-specific header.
	AuthHeaderKey AuthKind = iota
	// AuthBasic sends HTTP basic credentials.
	AuthBasic
	// AuthNone sends no credentials.
	AuthNone
	// AuthSession logs in with username and password once, then replays the
	// session cookie the service issued. qBittorrent's WebUI works this way.
	AuthSession
)

type BazarrBadgeCounts added in v0.3.0

type BazarrBadgeCounts struct {
	Episodes      int    `json:"episodes" jsonschema:"episodes missing subtitles"`
	Movies        int    `json:"movies" jsonschema:"movies missing subtitles"`
	Providers     int    `json:"providers" jsonschema:"providers currently throttled or erroring"`
	Status        int    `json:"status" jsonschema:"outstanding health issues"`
	SonarrSignalR string `json:"sonarr_signalr,omitempty" jsonschema:"LIVE when connected to Sonarr"`
	RadarrSignalR string `json:"radarr_signalr,omitempty" jsonschema:"LIVE when connected to Radarr"`
}

BazarrBadgeCounts summarises outstanding subtitle work. Cheapest first call for "is anything missing?" since it avoids listing every item.

func BazarrBadges added in v0.3.0

func BazarrBadges(ctx context.Context, c *Client) (BazarrBadgeCounts, error)

BazarrBadges returns outstanding subtitle counts. This endpoint is not data-wrapped, unlike most of the Bazarr API.

type BazarrHealthIssue added in v0.3.0

type BazarrHealthIssue struct {
	Object string `json:"object" jsonschema:"the path or item the problem concerns"`
	Issue  string `json:"issue" jsonschema:"what is wrong with it"`
}

BazarrHealthIssue is a Bazarr health problem. Bazarr reports {object, issue} rather than the {source, type, message} the *arr apps use.

func BazarrHealth added in v0.3.0

func BazarrHealth(ctx context.Context, c *Client) ([]BazarrHealthIssue, error)

BazarrHealth returns Bazarr's outstanding health issues.

type BazarrMovie added in v0.3.0

type BazarrMovie struct {
	RadarrID  int    `json:"radarrId"`
	Title     string `json:"title"`
	Monitored bool   `json:"monitored"`
	ProfileID int    `json:"profileId" jsonschema:"language profile id; 0 means none assigned"`
}

BazarrMovie is the trimmed subtitle view of a movie known to Bazarr.

func BazarrListMovies added in v0.3.0

func BazarrListMovies(ctx context.Context, c *Client, start, length int) ([]BazarrMovie, int, error)

BazarrListMovies returns a page of tracked movies with the library total.

type BazarrSeries added in v0.3.0

type BazarrSeries struct {
	SonarrSeriesID      int    `json:"sonarrSeriesId"`
	Title               string `json:"title"`
	Monitored           bool   `json:"monitored"`
	ProfileID           int    `json:"profileId" jsonschema:"language profile id; 0 means none assigned, which is why a series gets no subtitles"`
	EpisodeFileCount    int    `json:"episodeFileCount"`
	EpisodeMissingCount int    `json:"episodeMissingCount" jsonschema:"episodes missing subtitles"`
}

BazarrSeries is the trimmed subtitle view of a series known to Bazarr. The upstream payload also carries overview, artwork paths and alternate titles, which would dominate the response without answering any question.

func BazarrListSeries added in v0.3.0

func BazarrListSeries(ctx context.Context, c *Client, start, length int) ([]BazarrSeries, int, error)

BazarrListSeries returns a page of tracked series with the library total.

type BazarrTask added in v1.1.0

type BazarrTask struct {
	JobID      string `json:"job_id" jsonschema:"pass to bazarr_run_task to run it now"`
	Name       string `json:"name"`
	Interval   string `json:"interval"`
	JobRunning bool   `json:"job_running"`
	NextRunIn  string `json:"next_run_in,omitempty"`
}

BazarrTask is one of Bazarr's scheduled jobs. JobID is what runs it.

func BazarrTasks added in v1.1.0

func BazarrTasks(ctx context.Context, c *Client) ([]BazarrTask, error)

BazarrTasks returns Bazarr's scheduled jobs and when each next runs.

type BlocklistItem added in v0.3.0

type BlocklistItem struct {
	ID          int    `json:"id"`
	SeriesID    int    `json:"seriesId,omitempty"`
	MovieID     int    `json:"movieId,omitempty"`
	SourceTitle string `json:"sourceTitle"`
	Date        string `json:"date,omitempty"`
	Protocol    string `json:"protocol,omitempty"`
	Indexer     string `json:"indexer,omitempty"`
	Quality     string `json:"quality,omitempty"`
	Message     string `json:"message,omitempty" jsonschema:"why the release was blocklisted"`
}

BlocklistItem is a release the service refuses to grab again.

func ListBlocklist added in v0.3.0

func ListBlocklist(ctx context.Context, c *Client, pageSize int) ([]BlocklistItem, int, error)

ListBlocklist returns blocklisted releases newest first, with the total number held. The page is capped, so the total is the only honest answer to "how many releases are blocklisted?".

type Client

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

Client performs authenticated HTTP requests against one service instance.

func NewClient

func NewClient(baseURL string, spec ServiceSpec, creds Credentials) *Client

NewClient creates a client for a single instance of the service in spec.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, q ...Query) ([]byte, error)

Delete performs a DELETE request.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, q ...Query) ([]byte, error)

Get performs a GET request with optional query parameters.

func (*Client) Patch added in v0.3.0

func (c *Client) Patch(ctx context.Context, path string, q Query) ([]byte, error)

Patch performs a PATCH request driven by query parameters, which is how Bazarr expresses its mutations.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping checks that the instance is reachable and the credentials work.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body any) ([]byte, error)

Post performs a POST request with a JSON body.

func (*Client) PostForm added in v1.1.0

func (c *Client) PostForm(ctx context.Context, path string, form url.Values) ([]byte, error)

PostForm performs a POST with a form-encoded body, which is how qBittorrent expresses every mutation.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body any) ([]byte, error)

Put performs a PUT request with a JSON body.

func (*Client) Spec

func (c *Client) Spec() ServiceSpec

Spec returns the service description this client was built from.

func (*Client) WithTimeout added in v0.3.0

func (c *Client) WithTimeout(d time.Duration) *Client

WithTimeout returns a copy of the client using a different request timeout, for calls that legitimately run longer than a read. The original is unchanged.

type Collection added in v0.3.0

type Collection struct {
	ID                  int    `json:"id"`
	Title               string `json:"title"`
	TMDBID              int    `json:"tmdbId,omitempty"`
	Monitored           bool   `json:"monitored"`
	MovieCount          int    `json:"movieCount"`
	MissingMovies       int    `json:"missingMovies,omitempty"`
	QualityProfileID    int    `json:"qualityProfileId,omitempty"`
	RootFolderPath      string `json:"rootFolderPath,omitempty"`
	SearchOnAdd         bool   `json:"searchOnAdd,omitempty"`
	MinimumAvailability string `json:"minimumAvailability,omitempty"`
	Tags                []int  `json:"tags,omitempty"`
}

Collection is the trimmed view of a TMDB movie collection. The upstream resource embeds every movie it contains along with artwork and overviews — 259 KB for the list on a real instance — so only the counts survive.

func RadarrListCollections added in v0.3.0

func RadarrListCollections(ctx context.Context, c *Client) ([]Collection, error)

RadarrListCollections returns the TMDB collections Radarr tracks.

func RadarrUpdateCollection added in v1.2.0

func RadarrUpdateCollection(ctx context.Context, c *Client, in CollectionUpdate) (Collection, error)

RadarrUpdateCollection changes the settings applied to a TMDB collection and the movies added from it.

The record is read back and written whole, decoded into a map rather than a struct on purpose: a typed round trip would drop every field this package does not model -- the collection's images, sort title and member list among them -- and silently reset them on the instance.

type CollectionUpdate added in v1.2.0

type CollectionUpdate struct {
	ID                  int
	Monitored           *bool
	QualityProfileID    *int
	RootFolderPath      *string
	SearchOnAdd         *bool
	MinimumAvailability *string
}

CollectionUpdate describes a change to one Radarr collection. Every optional field is a pointer so an omitted argument stays absent from the request instead of resetting the setting to its zero value.

type CommandResult

type CommandResult struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status,omitempty"`
}

CommandResult reports the outcome of triggering a background command.

func ManualImport added in v1.2.0

func ManualImport(ctx context.Context, c *Client, files []ManualImportFile, importMode string) (CommandResult, error)

ManualImport imports specific files into the library.

This is the ManualImport *command*, not a POST to /manualimport: that route only reprocesses candidates and returns updated rows, so posting there would report success and leave every file exactly where it was.

func RadarrRefreshMovies added in v0.3.0

func RadarrRefreshMovies(ctx context.Context, c *Client, movieIDs []int) (CommandResult, error)

RadarrRefreshMovies rescans metadata and files for specific movies.

func RadarrRenameFiles added in v1.2.0

func RadarrRenameFiles(ctx context.Context, c *Client, movieID int, fileIDs []int) (CommandResult, error)

RadarrRenameFiles renames movie files to match the naming config.

func RadarrTriggerSearch added in v0.3.0

func RadarrTriggerSearch(ctx context.Context, c *Client, movieIDs []int) (CommandResult, error)

RadarrTriggerSearch starts an indexer search for specific movies.

func RunCommand

func RunCommand(ctx context.Context, c *Client, name string, extra map[string]any) (CommandResult, error)

RunCommand triggers a named background command such as RefreshSeries.

func SonarrRefreshSeries added in v0.3.0

func SonarrRefreshSeries(ctx context.Context, c *Client, seriesID int) (CommandResult, error)

SonarrRefreshSeries rescans one series' metadata and files.

func SonarrRenameFiles added in v1.2.0

func SonarrRenameFiles(ctx context.Context, c *Client, seriesID int, fileIDs []int) (CommandResult, error)

SonarrRenameFiles renames episode files to match the naming config.

func SonarrTriggerSearch added in v0.3.0

func SonarrTriggerSearch(ctx context.Context, c *Client, seriesID int, seasonNumber *int, episodeIDs []int) (CommandResult, error)

SonarrTriggerSearch starts an indexer search for a series, one of its seasons or a specific set of episodes, whichever the arguments describe. The three scopes are three different commands upstream, taking different parameters.

type Credentials

type Credentials struct {
	APIKey   string
	Username string
	Password string
}

Credentials carries the secrets for whichever auth scheme a spec selects.

type CustomFormat added in v0.3.0

type CustomFormat struct {
	ID                  int    `json:"id"`
	Name                string `json:"name"`
	IncludeWhenRenaming bool   `json:"includeCustomFormatWhenRenaming"`
	SpecificationCount  int    `json:"specificationCount" jsonschema:"number of matching rules in this format"`
}

CustomFormat is the trimmed view of a custom format. The upstream resource embeds every matching rule with its regular expressions; a real Sonarr returns nearly 300 KB for the full list, so only the identity and the rule count survive the projection.

func ListCustomFormats added in v0.3.0

func ListCustomFormats(ctx context.Context, c *Client) ([]CustomFormat, error)

ListCustomFormats returns the custom formats configured on an instance.

type CustomFormatCreate added in v1.4.0

type CustomFormatCreate struct {
	// Name identifies the format wherever releases are scored.
	Name string
	// IncludeWhenRenaming adds the format's name to renamed files.
	IncludeWhenRenaming bool
	// Specifications are the rules that make the format match.
	Specifications []CustomFormatSpecification
}

CustomFormatCreate describes a new custom format.

type CustomFormatDetail added in v1.4.0

type CustomFormatDetail struct {
	ID                  int                         `json:"id"`
	Name                string                      `json:"name"`
	IncludeWhenRenaming bool                        `json:"includeCustomFormatWhenRenaming"`
	Specifications      []CustomFormatSpecification `json:"specifications"`
}

CustomFormatDetail is one custom format with the rules that make it match.

func CreateCustomFormat added in v1.4.0

func CreateCustomFormat(ctx context.Context, c *Client, in CustomFormatCreate) (CustomFormatDetail, error)

CreateCustomFormat adds a custom format.

func GetCustomFormat added in v1.4.0

func GetCustomFormat(ctx context.Context, c *Client, id int) (CustomFormatDetail, error)

GetCustomFormat returns one custom format with its matching rules.

func UpdateCustomFormat added in v1.4.0

func UpdateCustomFormat(ctx context.Context, c *Client, in CustomFormatUpdate) (CustomFormatDetail, error)

UpdateCustomFormat changes a custom format in place, reading the stored record first so the parts that were not named survive the write.

type CustomFormatSpecification added in v1.4.0

type CustomFormatSpecification struct {
	Name           string         `json:"name"`
	Implementation string         `json:"implementation" jsonschema:"the rule type, e.g. ReleaseTitleSpecification or ReleaseGroupSpecification"`
	Negate         bool           `json:"negate,omitempty" jsonschema:"invert the rule, so a match rejects instead of accepts"`
	Required       bool           `json:"required,omitempty" jsonschema:"the format only matches when this rule does"`
	Fields         map[string]any `json:"fields,omitempty" jsonschema:"the rule's settings by name, e.g. value for a regular expression"`
}

CustomFormatSpecification is one rule that decides whether a custom format matches a release. Fields holds the rule's settings by name -- value carries the regular expression for the title and release-group rules -- because the upstream shape wraps each setting in a label, help text and privacy marker that answer nothing a caller asks.

type CustomFormatUpdate added in v1.4.0

type CustomFormatUpdate struct {
	// ID is the format to change.
	ID int
	// Name renames the format.
	Name *string
	// IncludeWhenRenaming adds the format's name to renamed files.
	IncludeWhenRenaming *bool
	// Specifications replaces the whole rule set.
	Specifications []CustomFormatSpecification
}

CustomFormatUpdate changes one custom format. Omitting a field leaves it as it was; giving Specifications replaces the rule set outright, because two rule lists cannot be merged without guessing which rules correspond.

type DelayProfile added in v0.3.0

type DelayProfile struct {
	ID                             int    `json:"id"`
	PreferredProtocol              string `json:"preferredProtocol,omitempty" jsonschema:"usenet or torrent"`
	UsenetDelay                    int    `json:"usenetDelay" jsonschema:"minutes to wait before grabbing a usenet release"`
	TorrentDelay                   int    `json:"torrentDelay" jsonschema:"minutes to wait before grabbing a torrent"`
	BypassIfHighestQuality         bool   `json:"bypassIfHighestQuality"`
	BypassIfAboveCustomFormatScore bool   `json:"bypassIfAboveCustomFormatScore"`
	MinimumCustomFormatScore       int    `json:"minimumCustomFormatScore,omitempty"`
	Order                          int    `json:"order,omitempty"`
	Tags                           []int  `json:"tags,omitempty" jsonschema:"tag ids this profile applies to; empty means the default profile"`
}

DelayProfile decides how long to wait before grabbing a release.

func ListDelayProfiles added in v0.3.0

func ListDelayProfiles(ctx context.Context, c *Client) ([]DelayProfile, error)

ListDelayProfiles returns the configured grab delay profiles.

func UpdateDelayProfile added in v1.4.0

func UpdateDelayProfile(ctx context.Context, c *Client, in DelayProfileUpdate) (DelayProfile, error)

UpdateDelayProfile changes a delay profile in place, reading the stored record first so its order and tags survive the write.

type DelayProfileUpdate added in v1.4.0

type DelayProfileUpdate struct {
	// ID is the profile to change.
	ID int
	// PreferredProtocol is usenet or torrent.
	PreferredProtocol *string
	// UsenetDelay is how many minutes to hold a usenet release.
	UsenetDelay *int
	// TorrentDelay is how many minutes to hold a torrent.
	TorrentDelay *int
	// EnableUsenet allows usenet releases at all.
	EnableUsenet *bool
	// EnableTorrent allows torrents at all.
	EnableTorrent *bool
	// BypassIfHighestQuality grabs immediately when nothing better can arrive.
	BypassIfHighestQuality *bool
}

DelayProfileUpdate changes one delay profile. Every field is optional so an omitted one leaves that setting alone.

type DiskSpace

type DiskSpace struct {
	Path       string `json:"path"`
	Label      string `json:"label,omitempty"`
	FreeSpace  int64  `json:"freeSpace" jsonschema:"free bytes"`
	TotalSpace int64  `json:"totalSpace" jsonschema:"total bytes"`
}

DiskSpace reports free and total bytes for a library path.

func ListDiskSpace

func ListDiskSpace(ctx context.Context, c *Client) ([]DiskSpace, error)

ListDiskSpace returns free and total space for each library path.

type EmbeddedSubtitleTrack added in v1.1.0

type EmbeddedSubtitleTrack struct {
	Stream          string `json:"stream" jsonschema:"track reference, e.g. s:0"`
	Name            string `json:"name,omitempty"`
	Language        string `json:"language,omitempty"`
	Forced          bool   `json:"forced,omitempty"`
	HearingImpaired bool   `json:"hearing_impaired,omitempty"`
}

EmbeddedSubtitleTrack is a subtitle stream inside the media file itself.

type Episode

type Episode struct {
	ID            int    `json:"id"`
	SeriesID      int    `json:"seriesId"`
	Title         string `json:"title"`
	SeasonNumber  int    `json:"seasonNumber"`
	EpisodeNumber int    `json:"episodeNumber"`
	AirDateUTC    string `json:"airDateUtc,omitempty"`
	HasFile       bool   `json:"hasFile"`
	Monitored     bool   `json:"monitored"`
}

Episode is the trimmed view of a Sonarr episode.

func SonarrCalendar

func SonarrCalendar(ctx context.Context, c *Client, start, end string) ([]Episode, error)

SonarrCalendar returns episodes airing between start and end (YYYY-MM-DD).

func SonarrListEpisodes

func SonarrListEpisodes(ctx context.Context, c *Client, seriesID int) ([]Episode, error)

SonarrListEpisodes returns every episode of one series.

func SonarrWantedCutoff added in v0.3.0

func SonarrWantedCutoff(ctx context.Context, c *Client, pageSize int) ([]Episode, int, error)

SonarrWantedCutoff returns monitored episodes whose file is below the quality cutoff, plus the total number across the library.

func SonarrWantedMissing added in v0.3.0

func SonarrWantedMissing(ctx context.Context, c *Client, pageSize int) ([]Episode, int, error)

SonarrWantedMissing returns monitored episodes that have aired but have no file, plus the total number missing across the whole library.

type EpisodeSubtitles added in v0.3.0

type EpisodeSubtitles struct {
	SonarrSeriesID   int                `json:"sonarrSeriesId"`
	SonarrEpisodeID  int                `json:"sonarrEpisodeId"`
	Title            string             `json:"title"`
	Season           int                `json:"season"`
	Episode          int                `json:"episode"`
	Subtitles        []SubtitleFile     `json:"subtitles"`
	MissingSubtitles []SubtitleLanguage `json:"missing_subtitles"`
}

EpisodeSubtitles lists the subtitles present and missing for one episode.

func BazarrListEpisodeSubtitles added in v0.3.0

func BazarrListEpisodeSubtitles(ctx context.Context, c *Client, seriesID int) ([]EpisodeSubtitles, error)

BazarrListEpisodeSubtitles returns the subtitles present and missing for each episode of a series. This is the only source of the file paths the deletion tools require.

type ExternalSubtitleTrack added in v1.1.0

type ExternalSubtitleTrack struct {
	Name            string `json:"name,omitempty"`
	Path            string `json:"path,omitempty"`
	Language        string `json:"language,omitempty"`
	Forced          bool   `json:"forced,omitempty"`
	HearingImpaired bool   `json:"hearing_impaired,omitempty"`
}

ExternalSubtitleTrack is a subtitle file alongside the media file.

type FormatScore added in v1.4.0

type FormatScore struct {
	Name  string `json:"name"`
	Score int    `json:"score"`
}

FormatScore is the score one custom format contributes in a profile.

type HealthIssue

type HealthIssue struct {
	Source  string `json:"source,omitempty"`
	Type    string `json:"type,omitempty" jsonschema:"ok, notice, warning, or error"`
	Message string `json:"message"`
	WikiURL string `json:"wikiUrl,omitempty"`
}

HealthIssue is a warning or error reported by a service's health checks.

func ListHealthIssues

func ListHealthIssues(ctx context.Context, c *Client) ([]HealthIssue, error)

ListHealthIssues returns the service's current health warnings and errors.

type HistoryRecord

type HistoryRecord struct {
	ID          int    `json:"id"`
	EventType   string `json:"eventType,omitempty"`
	Date        string `json:"date,omitempty"`
	SourceTitle string `json:"sourceTitle,omitempty"`
}

HistoryRecord is a past grab, import, or failure.

func ListHistory

func ListHistory(ctx context.Context, c *Client, pageSize int) ([]HistoryRecord, error)

ListHistory returns recent grab, import and failure events.

type Indexer

type Indexer struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	DefinitionName string `json:"definitionName,omitempty" jsonschema:"the definition this indexer was created from; pass it to prowlarr_add_indexer"`
	Implementation string `json:"implementation,omitempty" jsonschema:"Cardigann, Newznab, Torznab or a site-specific driver"`
	Protocol       string `json:"protocol,omitempty" jsonschema:"usenet or torrent"`
	Enable         bool   `json:"enable"`
	Priority       int    `json:"priority,omitempty"`
	AppProfileID   int    `json:"appProfileId,omitempty" jsonschema:"sync profile id from prowlarr_list_app_profiles"`
	Tags           []int  `json:"tags,omitempty"`
}

Indexer is the trimmed view of a Prowlarr indexer.

func ProwlarrListIndexers

func ProwlarrListIndexers(ctx context.Context, c *Client) ([]Indexer, error)

ProwlarrListIndexers returns the configured indexers.

type IndexerCreateRequest added in v1.1.0

type IndexerCreateRequest struct {
	// DefinitionName selects the schema entry to build from.
	DefinitionName string
	// Name is the display name for the new indexer.
	Name string
	// Enable, Priority and AppProfileID override the definition's defaults.
	Enable       *bool
	Priority     *int
	AppProfileID *int
	// Tags replaces the definition's tag list when non-nil.
	Tags []int
	// Fields sets indexer settings by field name, e.g. baseUrl or apiKey.
	Fields map[string]any
}

IndexerCreateRequest describes a new indexer. Optional settings are pointers so an omitted argument keeps the definition's own default instead of resetting it to a zero value.

type IndexerDetail added in v1.1.0

type IndexerDetail struct {
	Indexer
	Privacy     string         `json:"privacy,omitempty" jsonschema:"public, semiPrivate or private"`
	Language    string         `json:"language,omitempty"`
	IndexerURLs []string       `json:"indexerUrls,omitempty"`
	Fields      []IndexerField `json:"fields,omitempty"`
}

IndexerDetail is one configured indexer with its settings.

func ProwlarrAddIndexer added in v1.1.0

func ProwlarrAddIndexer(ctx context.Context, c *Client, req IndexerCreateRequest) (IndexerDetail, error)

ProwlarrAddIndexer creates an indexer from a definition. The definition's own resource is used as the request body so every key it declares is sent back intact, with only the caller's settings patched in.

func ProwlarrGetIndexer added in v1.1.0

func ProwlarrGetIndexer(ctx context.Context, c *Client, id int) (IndexerDetail, error)

ProwlarrGetIndexer returns one configured indexer with its settings, with every credential field masked.

func ProwlarrUpdateIndexer added in v1.1.0

func ProwlarrUpdateIndexer(ctx context.Context, c *Client, req IndexerUpdateRequest) (IndexerDetail, error)

ProwlarrUpdateIndexer changes one indexer. The current resource is read as a map and written back as one, so settings this package has no member for -- downloadClientId, configContract, the capabilities block -- survive the edit instead of being reset by a typed round-trip.

type IndexerField added in v1.1.0

type IndexerField struct {
	Name     string `json:"name"`
	Label    string `json:"label,omitempty"`
	Value    any    `json:"value,omitempty" jsonschema:"the configured value, or *** when the field holds a credential"`
	Type     string `json:"type,omitempty" jsonschema:"textbox, number, checkbox, select or info"`
	Privacy  string `json:"privacy,omitempty" jsonschema:"normal, apiKey, password or userName"`
	Advanced bool   `json:"advanced,omitempty"`
}

IndexerField is one setting of an indexer or an indexer definition.

Value is replaced with "***" whenever the upstream field declares a privacy other than "normal". Prowlarr marks credentials as apiKey, password or userName, and those are the indexer's own login details: nothing here should hand a model another service's credentials. The replacement is unconditional rather than value-dependent, so a new privacy value cannot leak by default.

type IndexerSchema added in v1.1.0

type IndexerSchema struct {
	Name           string         `json:"name"`
	DefinitionName string         `json:"definitionName,omitempty" jsonschema:"pass this to prowlarr_add_indexer"`
	Implementation string         `json:"implementation,omitempty"`
	Protocol       string         `json:"protocol,omitempty" jsonschema:"usenet or torrent"`
	Privacy        string         `json:"privacy,omitempty" jsonschema:"public, semiPrivate or private"`
	Language       string         `json:"language,omitempty"`
	Description    string         `json:"description,omitempty"`
	Fields         []IndexerField `json:"fields,omitempty"`
}

IndexerSchema is one indexer definition Prowlarr can create an indexer from. Fields are present only on the single-definition lookup: the raw list is 624 definitions and 5.7 MB on a stock instance, almost all of it field metadata.

func ProwlarrGetIndexerSchema added in v1.1.0

func ProwlarrGetIndexerSchema(ctx context.Context, c *Client, definitionName string) (IndexerSchema, error)

ProwlarrGetIndexerSchema returns one indexer definition with its settable fields. Several definitions share a definition name -- every Newznab and Torznab preset does -- and the first match is returned as the template, so presets differing only in baseUrl must be set through that field.

func ProwlarrListIndexerSchemas added in v1.1.0

func ProwlarrListIndexerSchemas(ctx context.Context, c *Client, query string, limit int) ([]IndexerSchema, error)

ProwlarrListIndexerSchemas returns the indexer definitions whose name or definition name contains query, compared case-insensitively. An empty query matches everything. limit defaults to 50.

type IndexerStat

type IndexerStat struct {
	IndexerID             int    `json:"indexerId"`
	IndexerName           string `json:"indexerName"`
	NumberOfQueries       int    `json:"numberOfQueries"`
	NumberOfGrabs         int    `json:"numberOfGrabs"`
	NumberOfFailedQueries int    `json:"numberOfFailedQueries,omitempty"`
}

IndexerStat summarises how one Prowlarr indexer has performed.

func ProwlarrIndexerStats

func ProwlarrIndexerStats(ctx context.Context, c *Client) ([]IndexerStat, error)

ProwlarrIndexerStats reports query and grab counts per indexer.

type IndexerTestResult added in v1.1.0

type IndexerTestResult struct {
	ID       int      `json:"id"`
	IsValid  bool     `json:"isValid"`
	Failures []string `json:"failures,omitempty" jsonschema:"why the test failed, one entry per validation error"`
}

IndexerTestResult reports whether an indexer answered a test request.

func ProwlarrTestAllIndexers added in v1.1.0

func ProwlarrTestAllIndexers(ctx context.Context, c *Client) ([]IndexerTestResult, error)

ProwlarrTestAllIndexers tests every configured indexer in one call.

func ProwlarrTestIndexer added in v1.1.0

func ProwlarrTestIndexer(ctx context.Context, c *Client, id int) (IndexerTestResult, error)

ProwlarrTestIndexer asks Prowlarr to contact one indexer. A rejected test is reported as IsValid false with the reasons, not as an error: "this indexer is unreachable" is the answer the caller wanted.

type IndexerUpdateRequest added in v1.1.0

type IndexerUpdateRequest struct {
	ID           int
	Name         *string
	Enable       *bool
	Priority     *int
	AppProfileID *int
	Tags         []int
	Fields       map[string]any
}

IndexerUpdateRequest changes one existing indexer. Every optional member is a pointer so an omitted argument leaves the current setting alone.

type LanguageProfile added in v1.1.0

type LanguageProfile struct {
	ProfileID int                   `json:"profileId" jsonschema:"assign this with bazarr_set_series_profile or bazarr_set_movie_profile"`
	Name      string                `json:"name"`
	Items     []LanguageProfileItem `json:"items"`
}

LanguageProfile is a Bazarr languages profile: the set of subtitle languages wanted for whatever series or movies it is assigned to.

func BazarrLanguageProfiles added in v1.1.0

func BazarrLanguageProfiles(ctx context.Context, c *Client) ([]LanguageProfile, error)

BazarrLanguageProfiles returns the configured languages profiles. Like /system/languages and /badges, this endpoint is not data-wrapped.

type LanguageProfileItem added in v1.1.0

type LanguageProfileItem struct {
	Language string `json:"language" jsonschema:"two-letter code, e.g. en"`
	HI       bool   `json:"hi,omitempty" jsonschema:"prefer hearing impaired subtitles"`
	Forced   bool   `json:"forced,omitempty"`
}

LanguageProfileItem is one language inside a Bazarr languages profile.

type LibraryStats added in v1.2.0

type LibraryStats struct {
	SeasonCount       int     `json:"seasonCount,omitempty"`
	EpisodeCount      int     `json:"episodeCount"`
	EpisodeFileCount  int     `json:"episodeFileCount"`
	TotalEpisodeCount int     `json:"totalEpisodeCount,omitempty"`
	SizeOnDisk        int64   `json:"sizeOnDisk,omitempty"`
	PercentOfEpisodes float64 `json:"percentOfEpisodes,omitempty"`
}

LibraryStats summarises how complete a series is.

type ManualImportCandidate added in v1.2.0

type ManualImportCandidate struct {
	ID           int      `json:"id"`
	Path         string   `json:"path" jsonschema:"pass back to the manual_import tool unchanged"`
	RelativePath string   `json:"relativePath,omitempty"`
	Size         int64    `json:"size,omitempty" jsonschema:"file size in bytes"`
	SeriesID     int      `json:"seriesId,omitempty"`
	SeriesTitle  string   `json:"seriesTitle,omitempty"`
	MovieID      int      `json:"movieId,omitempty"`
	MovieTitle   string   `json:"movieTitle,omitempty"`
	SeasonNumber *int     `json:"seasonNumber,omitempty"`
	EpisodeIDs   []int    `json:"episodeIds,omitempty"`
	Quality      string   `json:"quality,omitempty"`
	Languages    []string `json:"languages,omitempty"`
	ReleaseGroup string   `json:"releaseGroup,omitempty"`
	DownloadID   string   `json:"downloadId,omitempty"`
	Rejections   []string `json:"rejections,omitempty" jsonschema:"why this file cannot be imported as matched"`
}

ManualImportCandidate is one file the service could import, with the match it guessed. A candidate with rejections and no series or movie needs the caller to supply the missing identity before it can be imported.

func ListManualImportCandidates added in v1.2.0

func ListManualImportCandidates(ctx context.Context, c *Client, in ManualImportQuery) ([]ManualImportCandidate, error)

ListManualImportCandidates previews what a manual import would find, without importing anything.

type ManualImportFile added in v1.2.0

type ManualImportFile struct {
	Path         string
	SeriesID     int
	EpisodeIDs   []int
	MovieID      int
	Quality      string
	Languages    []string
	ReleaseGroup string
	DownloadID   string
}

ManualImportFile is one file to import and how to interpret it. Quality and Languages are names as the preview reports them, not ids.

type ManualImportQuery added in v1.2.0

type ManualImportQuery struct {
	// Folder is a path on the service's filesystem to scan.
	Folder string
	// DownloadID is the download client's hash for a finished download.
	DownloadID string
	// SeriesID hints which series the files belong to (Sonarr).
	SeriesID *int
	// MovieID hints which movie the files belong to (Radarr).
	MovieID *int
	// FilterExistingFiles drops files already in the library.
	FilterExistingFiles *bool
}

ManualImportQuery scopes a manual import preview. Exactly one of Folder and DownloadID identifies what to inspect.

type MediaFile added in v0.3.0

type MediaFile struct {
	ID                  int      `json:"id"`
	SeriesID            int      `json:"seriesId,omitempty"`
	MovieID             int      `json:"movieId,omitempty"`
	SeasonNumber        *int     `json:"seasonNumber,omitempty"`
	RelativePath        string   `json:"relativePath,omitempty"`
	Size                int64    `json:"size,omitempty" jsonschema:"file size in bytes"`
	DateAdded           string   `json:"dateAdded,omitempty"`
	Quality             string   `json:"quality,omitempty"`
	ReleaseGroup        string   `json:"releaseGroup,omitempty"`
	Languages           []string `json:"languages,omitempty"`
	CustomFormatScore   int      `json:"customFormatScore,omitempty"`
	QualityCutoffNotMet bool     `json:"qualityCutoffNotMet,omitempty" jsonschema:"true when a better release would still be an upgrade"`
}

MediaFile is the trimmed view of an episode file or a movie file. The upstream resources are dominated by a mediaInfo block and a custom format list: one Sonarr series' files come to 252 KB raw, which no listing can afford. SeasonNumber is a pointer because season 0 is specials and would otherwise be indistinguishable from "no season".

func RadarrListMovieFiles added in v0.3.0

func RadarrListMovieFiles(ctx context.Context, c *Client, movieID int) ([]MediaFile, error)

RadarrListMovieFiles returns the files on disk for one movie.

func RadarrUpdateMovieFiles added in v1.2.0

func RadarrUpdateMovieFiles(ctx context.Context, c *Client, fileIDs []int,
	quality *string, languages []string, releaseGroup *string) ([]MediaFile, error)

RadarrUpdateMovieFiles corrects the quality, languages or release group recorded for movie files.

func SonarrListEpisodeFiles added in v0.3.0

func SonarrListEpisodeFiles(ctx context.Context, c *Client, seriesID int) ([]MediaFile, error)

SonarrListEpisodeFiles returns the files on disk for one series.

func SonarrUpdateEpisodeFiles added in v1.2.0

func SonarrUpdateEpisodeFiles(ctx context.Context, c *Client, fileIDs []int,
	quality *string, languages []string, releaseGroup *string) ([]MediaFile, error)

SonarrUpdateEpisodeFiles corrects the quality, languages or release group recorded for episode files.

type MediaManagementConfig added in v1.4.0

type MediaManagementConfig struct {
	ID int `json:"id"`

	AutoUnmonitorPreviouslyDownloadedEpisodes bool   `json:"autoUnmonitorPreviouslyDownloadedEpisodes,omitempty" jsonschema:"Sonarr only"`
	AutoUnmonitorPreviouslyDownloadedMovies   bool   `json:"autoUnmonitorPreviouslyDownloadedMovies,omitempty" jsonschema:"Radarr only"`
	CreateEmptySeriesFolders                  bool   `json:"createEmptySeriesFolders,omitempty" jsonschema:"Sonarr only"`
	CreateEmptyMovieFolders                   bool   `json:"createEmptyMovieFolders,omitempty" jsonschema:"Radarr only"`
	EpisodeTitleRequired                      string `json:"episodeTitleRequired,omitempty" jsonschema:"Sonarr only; always, bulkSeasonReleases or never"`
	AutoRenameFolders                         bool   `json:"autoRenameFolders,omitempty" jsonschema:"Radarr only"`

	RecycleBin                      string `json:"recycleBin,omitempty" jsonschema:"deleted files are moved here; empty means they are removed outright"`
	RecycleBinCleanupDays           int    `json:"recycleBinCleanupDays,omitempty"`
	DownloadPropersAndRepacks       string `json:"downloadPropersAndRepacks,omitempty" jsonschema:"preferAndUpgrade, doNotUpgrade or doNotPrefer"`
	DeleteEmptyFolders              bool   `json:"deleteEmptyFolders"`
	FileDate                        string `json:"fileDate,omitempty"`
	RescanAfterRefresh              string `json:"rescanAfterRefresh,omitempty" jsonschema:"always, afterManual or never"`
	SkipFreeSpaceCheckWhenImporting bool   `json:"skipFreeSpaceCheckWhenImporting"`
	MinimumFreeSpaceWhenImporting   int    `json:"minimumFreeSpaceWhenImporting,omitempty" jsonschema:"megabytes that must stay free"`
	CopyUsingHardlinks              bool   `json:"copyUsingHardlinks" jsonschema:"hardlink instead of copying, so seeding torrents cost no extra space"`
	ImportExtraFiles                bool   `json:"importExtraFiles"`
	ExtraFileExtensions             string `json:"extraFileExtensions,omitempty" jsonschema:"comma-separated, e.g. srt,nfo"`
	EnableMediaInfo                 bool   `json:"enableMediaInfo"`
	SetPermissionsLinux             bool   `json:"setPermissionsLinux"`
	ChmodFolder                     string `json:"chmodFolder,omitempty"`
	ChownGroup                      string `json:"chownGroup,omitempty"`
}

MediaManagementConfig is the file handling policy: what happens to imported files, deleted files and empty folders. The Sonarr-only and Radarr-only fields are both present and omitted when empty, because the two services describe the same settings with different names.

func GetMediaManagementConfig added in v1.4.0

func GetMediaManagementConfig(ctx context.Context, c *Client) (MediaManagementConfig, error)

GetMediaManagementConfig returns the file handling policy.

func UpdateMediaManagementConfig added in v1.4.0

func UpdateMediaManagementConfig(ctx context.Context, c *Client, in MediaManagementConfigUpdate) (MediaManagementConfig, error)

UpdateMediaManagementConfig changes the file handling policy, reading it first so the settings this package does not model survive the write.

type MediaManagementConfigUpdate added in v1.4.0

type MediaManagementConfigUpdate struct {
	// AutoUnmonitorPreviouslyDownloaded stops monitoring media whose files are
	// deleted. It lands on whichever of the two names the instance uses.
	AutoUnmonitorPreviouslyDownloaded *bool
	// CreateEmptyMediaFolders creates a folder for media with no files yet. It
	// lands on whichever of the two names the instance uses.
	CreateEmptyMediaFolders *bool

	RecycleBin                      *string
	RecycleBinCleanupDays           *int
	DownloadPropersAndRepacks       *string
	DeleteEmptyFolders              *bool
	FileDate                        *string
	RescanAfterRefresh              *string
	SkipFreeSpaceCheckWhenImporting *bool
	MinimumFreeSpaceWhenImporting   *int
	CopyUsingHardlinks              *bool
	ImportExtraFiles                *bool
	ExtraFileExtensions             *string
	EnableMediaInfo                 *bool
}

MediaManagementConfigUpdate changes the file handling policy. Every field is optional so an omitted one leaves that setting alone.

type Movie

type Movie struct {
	ID        int    `json:"id" jsonschema:"Radarr's internal movie id, used by other tools"`
	Title     string `json:"title"`
	Year      int    `json:"year,omitempty"`
	Status    string `json:"status,omitempty"`
	Monitored bool   `json:"monitored"`
	HasFile   bool   `json:"hasFile" jsonschema:"whether the movie is downloaded"`
	TMDBID    int    `json:"tmdbId,omitempty" jsonschema:"TMDB id, required when adding the movie"`
}

Movie is the trimmed view of a Radarr movie returned to MCP clients.

func RadarrAddMovie

func RadarrAddMovie(ctx context.Context, c *Client, req AddMovieRequest) (Movie, error)

RadarrAddMovie adds a movie to the library and returns the created record.

func RadarrCalendar

func RadarrCalendar(ctx context.Context, c *Client, start, end string) ([]Movie, error)

RadarrCalendar returns movies releasing between start and end (YYYY-MM-DD).

func RadarrEditMovies added in v0.3.0

func RadarrEditMovies(ctx context.Context, c *Client, req MovieEditRequest) ([]Movie, error)

RadarrEditMovies applies a change to a set of movies at once.

func RadarrListMovies

func RadarrListMovies(ctx context.Context, c *Client) ([]Movie, error)

RadarrListMovies returns every movie in the library.

func RadarrLookupMovies

func RadarrLookupMovies(ctx context.Context, c *Client, term string) ([]Movie, error)

RadarrLookupMovies searches for movies matching term.

func RadarrWantedCutoff added in v0.3.0

func RadarrWantedCutoff(ctx context.Context, c *Client, pageSize int) ([]Movie, int, error)

RadarrWantedCutoff returns monitored movies whose file is below the quality cutoff, plus the total number across the library.

func RadarrWantedMissing added in v0.3.0

func RadarrWantedMissing(ctx context.Context, c *Client, pageSize int) ([]Movie, int, error)

RadarrWantedMissing returns monitored movies that have been released but have no file, plus the total number missing across the library.

type MovieDetail added in v1.2.0

type MovieDetail struct {
	ID                  int        `json:"id"`
	Title               string     `json:"title"`
	Year                int        `json:"year,omitempty"`
	Status              string     `json:"status,omitempty"`
	Monitored           bool       `json:"monitored"`
	HasFile             bool       `json:"hasFile"`
	TMDBID              int        `json:"tmdbId,omitempty"`
	IMDBID              string     `json:"imdbId,omitempty"`
	Path                string     `json:"path,omitempty"`
	RootFolderPath      string     `json:"rootFolderPath,omitempty"`
	QualityProfileID    int        `json:"qualityProfileId,omitempty"`
	MinimumAvailability string     `json:"minimumAvailability,omitempty"`
	Runtime             int        `json:"runtime,omitempty" jsonschema:"minutes"`
	SizeOnDisk          int64      `json:"sizeOnDisk,omitempty"`
	IsAvailable         bool       `json:"isAvailable" jsonschema:"whether the movie has reached its minimum availability"`
	Added               string     `json:"added,omitempty"`
	Tags                []int      `json:"tags,omitempty"`
	CollectionTitle     string     `json:"collectionTitle,omitempty"`
	File                *MediaFile `json:"file,omitempty" jsonschema:"the file on disk, when there is one"`
}

MovieDetail is one movie with its file summary. As with the series view, the overview, artwork, ratings and alternate titles are dropped.

func RadarrGetMovie added in v1.2.0

func RadarrGetMovie(ctx context.Context, c *Client, id int) (MovieDetail, error)

RadarrGetMovie returns one movie with a summary of the file on disk.

type MovieEditRequest added in v0.3.0

type MovieEditRequest struct {
	MovieIDs            []int  `json:"movieIds"`
	Monitored           *bool  `json:"monitored,omitempty"`
	QualityProfileID    *int   `json:"qualityProfileId,omitempty"`
	MinimumAvailability string `json:"minimumAvailability,omitempty" jsonschema:"tba, announced, inCinemas or released"`
	RootFolderPath      string `json:"rootFolderPath,omitempty"`
	Tags                []int  `json:"tags,omitempty"`
	ApplyTags           string `json:"applyTags,omitempty" jsonschema:"add, remove or replace"`
	MoveFiles           bool   `json:"moveFiles"`
}

MovieEditRequest describes a bulk change to one or more movies. As with the Sonarr editor, optional fields must stay absent rather than be sent as zero values, or they would overwrite settings the caller never named.

type NZBGroup added in v1.1.0

type NZBGroup struct {
	ID              int     `json:"id" jsonschema:"NZBID used by every queue editing tool"`
	Name            string  `json:"name"`
	Status          string  `json:"status" jsonschema:"e.g. DOWNLOADING, PAUSED, QUEUED, UNPACKING, PP_QUEUED"`
	Category        string  `json:"category,omitempty"`
	SizeMB          int     `json:"sizeMB"`
	RemainingMB     int     `json:"remainingMB"`
	PausedMB        int     `json:"pausedMB" jsonschema:"part of remainingMB belonging to paused files"`
	DownloadedMB    int     `json:"downloadedMB"`
	HealthPercent   float64 `json:"healthPercent" jsonschema:"expected completeness; below 100 means articles are missing"`
	ActiveDownloads int     `json:"activeDownloads" jsonschema:"connections currently downloading this item"`
	Priority        int     `json:"priority" jsonschema:"-100 very low, -50 low, 0 normal, 50 high, 100 very high, 900 force"`
	DestDir         string  `json:"destDir,omitempty"`
}

NZBGroup is one queue entry (an nzb and its files) in the trimmed form the tools return. Upstream also carries per-file counts, article statistics and duplicate metadata that do not help decide what to do with the queue.

func NZBGetListGroups added in v1.1.0

func NZBGetListGroups(ctx context.Context, c *Client) ([]NZBGroup, error)

NZBGetListGroups returns the download queue, one entry per nzb.

type NZBHistoryItem added in v1.1.0

type NZBHistoryItem struct {
	ID            int     `json:"id" jsonschema:"NZBID used by the history tools"`
	Name          string  `json:"name"`
	Kind          string  `json:"kind" jsonschema:"NZB, URL (a fetch that failed) or DUP (a hidden duplicate)"`
	Status        string  `json:"status" jsonschema:"e.g. SUCCESS/UNPACK, FAILURE/PAR, DELETED/MANUAL, WARNING/HEALTH"`
	Category      string  `json:"category,omitempty"`
	SizeMB        int     `json:"sizeMB"`
	Time          string  `json:"time,omitempty" jsonschema:"when the item entered history, RFC 3339 UTC"`
	DestDir       string  `json:"destDir,omitempty"`
	FinalDir      string  `json:"finalDir,omitempty" jsonschema:"where post-processing moved the files, when different from destDir"`
	HealthPercent float64 `json:"healthPercent"`
	DupeKey       string  `json:"dupeKey,omitempty"`
	DeleteStatus  string  `json:"deleteStatus,omitempty" jsonschema:"why it was deleted: NONE, MANUAL, HEALTH, DUPE, BAD, SCAN or COPY"`
	MarkStatus    string  `json:"markStatus,omitempty" jsonschema:"NONE, GOOD or BAD"`
}

NZBHistoryItem is one finished, failed or deleted download.

func NZBGetHistory added in v1.1.0

func NZBGetHistory(ctx context.Context, c *Client, hidden bool, limit int) ([]NZBHistoryItem, error)

NZBGetHistory returns history entries, newest first as NZBGet orders them. hidden also includes records hidden by HistoryDelete and DUP entries. NZBGet has no paging, so limit truncates client-side; 0 returns everything.

type NZBStatus added in v1.1.0

type NZBStatus struct {
	Version          string `json:"version"`
	DownloadRateKB   int    `json:"downloadRateKB" jsonschema:"current download speed in KiB/s"`
	DownloadLimitKB  int    `json:"downloadLimitKB" jsonschema:"configured speed limit in KiB/s; 0 means unlimited"`
	RemainingSizeMB  int    `json:"remainingSizeMB" jsonschema:"size of everything still queued"`
	DownloadedSizeMB int    `json:"downloadedSizeMB" jsonschema:"downloaded since the server started"`
	FreeDiskSpaceMB  int    `json:"freeDiskSpaceMB"`
	DownloadPaused   bool   `json:"downloadPaused"`
	PostPaused       bool   `json:"postPaused" jsonschema:"post-processing (par repair, unpack, scripts) is paused"`
	ScanPaused       bool   `json:"scanPaused" jsonschema:"scanning of the incoming nzb directory is paused"`
	ServerStandBy    bool   `json:"serverStandBy" jsonschema:"true when nothing is downloading"`
	ThreadCount      int    `json:"threadCount"`
	PostJobCount     int    `json:"postJobCount" jsonschema:"jobs waiting for post-processing"`
	UpTimeSec        int    `json:"upTimeSec"`
	DownloadTimeSec  int    `json:"downloadTimeSec"`
}

NZBStatus is the trimmed view of NZBGet's status call. Rates are reported in KiB/s to match the unit the rate limit is set in; upstream reports bytes.

func NZBGetStatus added in v1.1.0

func NZBGetStatus(ctx context.Context, c *Client) (NZBStatus, error)

NZBGetStatus returns the trimmed server status together with its version.

type NamingConfig added in v0.3.0

type NamingConfig struct {
	ID                       int    `json:"id"`
	ReplaceIllegalCharacters bool   `json:"replaceIllegalCharacters"`
	RenameEpisodes           bool   `json:"renameEpisodes,omitempty" jsonschema:"Sonarr only"`
	RenameMovies             bool   `json:"renameMovies,omitempty" jsonschema:"Radarr only"`
	StandardEpisodeFormat    string `json:"standardEpisodeFormat,omitempty"`
	DailyEpisodeFormat       string `json:"dailyEpisodeFormat,omitempty"`
	AnimeEpisodeFormat       string `json:"animeEpisodeFormat,omitempty"`
	SeriesFolderFormat       string `json:"seriesFolderFormat,omitempty"`
	SeasonFolderFormat       string `json:"seasonFolderFormat,omitempty"`
	SpecialsFolderFormat     string `json:"specialsFolderFormat,omitempty"`
	StandardMovieFormat      string `json:"standardMovieFormat,omitempty"`
	MovieFolderFormat        string `json:"movieFolderFormat,omitempty"`
}

NamingConfig is the file and folder naming policy. The Sonarr-only and Radarr-only fields are both present and omitted when empty, because the two services describe the same setting with different names.

colonReplacementFormat is deliberately absent: Sonarr sends it as an integer and Radarr as a string, so no single Go field decodes both.

func GetNamingConfig added in v0.3.0

func GetNamingConfig(ctx context.Context, c *Client) (NamingConfig, error)

GetNamingConfig returns the file and folder naming policy.

func UpdateNamingConfig added in v1.4.0

func UpdateNamingConfig(ctx context.Context, c *Client, in NamingConfigUpdate) (NamingConfig, error)

UpdateNamingConfig changes the naming policy, reading it first so the settings this package does not model survive the write. colonReplacementFormat is the reason that matters: Sonarr sends it as an integer and Radarr as a string, so a typed round trip would have to drop it.

type NamingConfigUpdate added in v1.4.0

type NamingConfigUpdate struct {
	// RenameFiles turns renaming on or off. It lands on renameEpisodes or
	// renameMovies, whichever the instance has.
	RenameFiles *bool
	// ReplaceIllegalCharacters substitutes characters the filesystem rejects.
	ReplaceIllegalCharacters *bool

	StandardEpisodeFormat *string
	DailyEpisodeFormat    *string
	AnimeEpisodeFormat    *string
	SeriesFolderFormat    *string
	SeasonFolderFormat    *string
	SpecialsFolderFormat  *string
	StandardMovieFormat   *string
	MovieFolderFormat     *string
}

NamingConfigUpdate changes the file and folder naming policy. Every field is optional so an omitted one leaves that format string alone, and the service-specific ones are refused rather than invented on the instance that does not have them.

type Provider added in v0.3.0

type Provider struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Implementation string `json:"implementation,omitempty"`
	Protocol       string `json:"protocol,omitempty" jsonschema:"usenet or torrent, for indexers and download clients"`
	Enabled        bool   `json:"enabled"`
	Priority       int    `json:"priority,omitempty"`
	Tags           []int  `json:"tags,omitempty"`

	SupportsSearch          bool `json:"supportsSearch,omitempty"`
	EnableRSS               bool `json:"enableRss,omitempty"`
	EnableAutomaticSearch   bool `json:"enableAutomaticSearch,omitempty"`
	EnableInteractiveSearch bool `json:"enableInteractiveSearch,omitempty"`

	RootFolderPath   string `json:"rootFolderPath,omitempty" jsonschema:"import lists only"`
	QualityProfileID int    `json:"qualityProfileId,omitempty" jsonschema:"import lists only"`
}

Provider is the trimmed view of a configured indexer, download client, import list or notification connection. These resources all share one shape whose `fields` array holds the connection settings — including indexer API keys, download client passwords and notification webhook URLs. That array is deliberately dropped: nothing here should hand a model another service's credentials.

func ListDownloadClients added in v0.3.0

func ListDownloadClients(ctx context.Context, c *Client) ([]Provider, error)

ListDownloadClients returns the configured download clients.

func ListImportLists added in v0.3.0

func ListImportLists(ctx context.Context, c *Client) ([]Provider, error)

ListImportLists returns the configured import lists.

func ListIndexers added in v0.3.0

func ListIndexers(ctx context.Context, c *Client) ([]Provider, error)

ListIndexers returns the indexers a media service searches.

func ListNotifications added in v0.3.0

func ListNotifications(ctx context.Context, c *Client) ([]Provider, error)

ListNotifications returns the configured notification connections.

type ProviderCreateRequest added in v1.3.0

type ProviderCreateRequest struct {
	// Kind selects the provider family; see providerKind for the valid values.
	Kind string
	// Implementation selects the schema entry to build from.
	Implementation string
	// Name is the display name for the new provider.
	Name string
	// Flags and Priority override the implementation's defaults.
	Flags    ProviderFlags
	Priority *int
	// Tags replaces the implementation's tag list when non-nil.
	Tags []int
	// Fields sets connection settings by field name, e.g. host or apiKey.
	Fields map[string]any
}

ProviderCreateRequest describes a new provider. Optional settings are pointers so an omitted argument keeps the implementation's own default instead of resetting it to a zero value.

type ProviderDetail added in v1.3.0

type ProviderDetail struct {
	Provider
	Kind           string         `json:"kind" jsonschema:"indexer, downloadClient, notification or importList"`
	ConfigContract string         `json:"configContract,omitempty" jsonschema:"the settings contract the implementation uses"`
	Fields         []IndexerField `json:"fields,omitempty" jsonschema:"connection settings by name; credential values report ***"`
}

ProviderDetail is one configured indexer, download client, notification or import list with its settings.

Fields carries the provider's own connection settings, and every one whose upstream privacy is anything other than "normal" reports "***" instead of its value. Sonarr and Radarr mark credentials as apiKey, password or userName; the masking is default-deny, so a privacy value this package has never seen is masked too.

func AddProvider added in v1.3.0

func AddProvider(ctx context.Context, c *Client, req ProviderCreateRequest) (ProviderDetail, error)

AddProvider creates a provider from one of the service's implementations. The schema entry is used as the request body so every key it declares is sent back intact, with only the caller's settings patched in.

func GetProvider added in v1.3.0

func GetProvider(ctx context.Context, c *Client, kind string, id int) (ProviderDetail, error)

GetProvider returns one configured provider with its settings, with every credential field masked.

func UpdateProvider added in v1.3.0

func UpdateProvider(ctx context.Context, c *Client, req ProviderUpdateRequest) (ProviderDetail, error)

UpdateProvider changes one provider. The current resource is read as a map and written back as one, so settings this package has no member for -- a notification's onGrab triggers, an indexer's downloadClientId, the config contract -- survive the edit instead of being reset by a typed round-trip.

It also means an untouched credential is sent back at its stored value. The mask a read applies is never written: doing so would replace the provider's password with three asterisks.

type ProviderFlags added in v1.3.0

type ProviderFlags struct {
	// Enable is the download client switch.
	Enable *bool
	// EnableRSS, EnableAutomaticSearch and EnableInteractiveSearch are the
	// indexer switches.
	EnableRSS               *bool
	EnableAutomaticSearch   *bool
	EnableInteractiveSearch *bool
	// EnableAutomaticAdd is the import list switch.
	EnableAutomaticAdd *bool
}

ProviderFlags are the enable switches a provider resource may declare. Each is a pointer so an omitted argument leaves the stored setting alone, and each is applied only when the resource actually has it: an indexer has the three search switches, a download client has enable, an import list has enableAutomaticAdd, and a notification has none of them -- its onGrab, onDownload and other triggers are preserved by the read-modify-write instead.

type ProviderSchema added in v1.3.0

type ProviderSchema struct {
	Implementation     string                `json:"implementation" jsonschema:"pass this to the add tool"`
	ImplementationName string                `json:"implementationName,omitempty" jsonschema:"the name the web UI shows"`
	ConfigContract     string                `json:"configContract,omitempty"`
	Protocol           string                `json:"protocol,omitempty" jsonschema:"usenet or torrent, for indexers and download clients"`
	InfoLink           string                `json:"infoLink,omitempty"`
	Fields             []ProviderSchemaField `json:"fields,omitempty"`
}

ProviderSchema is one implementation a provider can be created from.

func ListProviderSchemas added in v1.3.0

func ListProviderSchemas(ctx context.Context, c *Client, kind, query string, limit int) ([]ProviderSchema, error)

ListProviderSchemas returns the implementations of one provider kind whose implementation or display name contains query, compared case-insensitively. An empty query matches everything. limit defaults to 10.

type ProviderSchemaField added in v1.3.0

type ProviderSchemaField struct {
	Name     string `json:"name" jsonschema:"pass this as a key of the fields argument"`
	Label    string `json:"label,omitempty"`
	Type     string `json:"type,omitempty" jsonschema:"textbox, password, number, checkbox, select, path, tag or info"`
	Privacy  string `json:"privacy,omitempty" jsonschema:"normal, apiKey, password or userName"`
	Advanced bool   `json:"advanced,omitempty"`
}

ProviderSchemaField names one setting an implementation accepts. There is no value member at all: the schema exists to name the settings, and a template value is at best a default and at worst an example credential.

type ProviderTestResult added in v1.3.0

type ProviderTestResult = IndexerTestResult

ProviderTestResult is the outcome of asking a service to contact one provider. It is the same shape as an indexer test: the provider's id, whether it answered, and the validation failures when it did not.

func TestProvider added in v1.3.0

func TestProvider(ctx context.Context, c *Client, kind string, id int) (ProviderTestResult, error)

TestProvider asks the service to contact one provider. A rejected test is reported as IsValid false with the reasons, not as an error: "this provider is unreachable" is the answer the caller wanted.

type ProviderUpdateRequest added in v1.3.0

type ProviderUpdateRequest struct {
	Kind     string
	ID       int
	Name     *string
	Flags    ProviderFlags
	Priority *int
	Tags     []int
	Fields   map[string]any
}

ProviderUpdateRequest changes one existing provider. Every optional member is a pointer so an omitted argument leaves that setting alone.

type QBittorrentVersion added in v1.1.0

type QBittorrentVersion struct {
	Version    string `json:"version"`
	APIVersion string `json:"apiVersion"`
}

QBittorrentVersion reports the application and WebUI API versions.

func QBittorrentSystemStatus added in v1.1.0

func QBittorrentSystemStatus(ctx context.Context, c *Client) (QBittorrentVersion, error)

QBittorrentSystemStatus reports the application and API versions. Both endpoints answer with plain text rather than JSON.

type QualityDefinition added in v0.3.0

type QualityDefinition struct {
	ID            int      `json:"id"`
	Title         string   `json:"title"`
	Quality       string   `json:"quality,omitempty"`
	Resolution    int      `json:"resolution,omitempty"`
	MinSize       *float64 `json:"minSize,omitempty" jsonschema:"megabytes per minute; null means no lower limit"`
	MaxSize       *float64 `json:"maxSize,omitempty" jsonschema:"megabytes per minute; null means unlimited"`
	PreferredSize *float64 `json:"preferredSize,omitempty"`
}

QualityDefinition is the size policy for one quality level.

func ListQualityDefinitions added in v0.3.0

func ListQualityDefinitions(ctx context.Context, c *Client) ([]QualityDefinition, error)

ListQualityDefinitions returns the size limits for each quality level.

type QualityProfile

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

QualityProfile is a quality profile as needed when adding media.

func ListQualityProfiles

func ListQualityProfiles(ctx context.Context, c *Client) ([]QualityProfile, error)

ListQualityProfiles returns the quality profiles configured on an instance. Sonarr and Radarr share this endpoint shape.

type QualityProfileCreate added in v1.4.0

type QualityProfileCreate struct {
	// Name identifies the profile in the library.
	Name string
	// Allowed names the qualities and quality groups the profile accepts.
	Allowed []string
	// Cutoff names the quality upgrading stops at; empty picks the best of
	// Allowed.
	Cutoff string
	// UpgradeAllowed decides whether a better release replaces one on disk.
	UpgradeAllowed *bool
}

QualityProfileCreate describes a new quality profile. Qualities are named rather than numbered, so a caller never has to guess an id.

type QualityProfileDetail added in v1.4.0

type QualityProfileDetail struct {
	ID                    int                  `json:"id"`
	Name                  string               `json:"name"`
	UpgradeAllowed        bool                 `json:"upgradeAllowed" jsonschema:"whether a better release replaces one already on disk"`
	Cutoff                string               `json:"cutoff,omitempty" jsonschema:"the quality or group upgrading stops at"`
	MinFormatScore        int                  `json:"minFormatScore"`
	CutoffFormatScore     int                  `json:"cutoffFormatScore"`
	MinUpgradeFormatScore int                  `json:"minUpgradeFormatScore,omitempty"`
	Language              string               `json:"language,omitempty" jsonschema:"Radarr only"`
	Items                 []QualityProfileItem `json:"items" jsonschema:"every quality the profile knows, worst first"`
	FormatScores          []FormatScore        `json:"formatScores,omitempty" jsonschema:"custom formats scored non-zero; the rest are omitted"`
}

QualityProfileDetail is one quality profile with the qualities it accepts and the custom format scores it applies. The cutoff is reported by name because upstream stores it as an id a caller cannot act on, and the format scores are trimmed to the formats actually scored: a real profile lists every custom format on the instance, most of them sitting at zero.

func CreateQualityProfile added in v1.4.0

func CreateQualityProfile(ctx context.Context, c *Client, in QualityProfileCreate) (QualityProfileDetail, error)

CreateQualityProfile adds a quality profile, starting from the instance's own schema so the qualities, groups and per-service settings come from the service rather than from assumptions about which ones exist.

func GetQualityProfile added in v1.4.0

func GetQualityProfile(ctx context.Context, c *Client, id int) (QualityProfileDetail, error)

GetQualityProfile returns one quality profile in full.

func UpdateQualityProfile added in v1.4.0

func UpdateQualityProfile(ctx context.Context, c *Client, in QualityProfileUpdate) (QualityProfileDetail, error)

UpdateQualityProfile changes a quality profile in place, reading the stored record first so the settings this package does not model survive the write.

type QualityProfileItem added in v1.4.0

type QualityProfileItem struct {
	Name    string   `json:"name"`
	Allowed bool     `json:"allowed"`
	Members []string `json:"members,omitempty" jsonschema:"the qualities in this group, worst first"`
}

QualityProfileItem is one entry in a profile's quality list: either a single quality or a named group of qualities the profile treats as equivalent.

type QualityProfileUpdate added in v1.4.0

type QualityProfileUpdate struct {
	// ID is the profile to change.
	ID int
	// Name renames the profile.
	Name *string
	// UpgradeAllowed decides whether a better release replaces one on disk.
	UpgradeAllowed *bool
	// Cutoff names the quality upgrading stops at.
	Cutoff *string
	// Allow names qualities to accept, in addition to those already accepted.
	Allow []string
	// Disallow names qualities to stop accepting.
	Disallow []string
	// MinFormatScore is the custom format score a release must reach.
	MinFormatScore *int
	// CutoffFormatScore is the score above which upgrading stops.
	CutoffFormatScore *int
	// FormatScores sets the score of named custom formats.
	FormatScores map[string]int
}

QualityProfileUpdate changes one quality profile. Every field is optional so an omitted one leaves that setting exactly as it was.

type Query

type Query map[string]string

Query is a set of URL query parameters.

type QueueItem

type QueueItem struct {
	ID             int    `json:"id"`
	Title          string `json:"title"`
	Status         string `json:"status,omitempty"`
	TimeLeft       string `json:"timeleft,omitempty"`
	Size           int64  `json:"size,omitempty"`
	SizeLeft       int64  `json:"sizeleft,omitempty"`
	Protocol       string `json:"protocol,omitempty"`
	DownloadClient string `json:"downloadClient,omitempty"`
	ErrorMessage   string `json:"errorMessage,omitempty"`
}

QueueItem is an in-progress or pending download.

func ListQueue

func ListQueue(ctx context.Context, c *Client, pageSize int) ([]QueueItem, error)

ListQueue returns the current download queue, newest first.

type QueueStatus added in v0.3.0

type QueueStatus struct {
	TotalCount   int  `json:"totalCount"`
	Count        int  `json:"count"`
	UnknownCount int  `json:"unknownCount,omitempty"`
	Errors       bool `json:"errors"`
	Warnings     bool `json:"warnings"`
}

QueueStatus summarises the download queue without listing it.

func GetQueueStatus added in v0.3.0

func GetQueueStatus(ctx context.Context, c *Client) (QueueStatus, error)

GetQueueStatus summarises the download queue in one small record.

type ReleaseCandidate added in v1.2.0

type ReleaseCandidate struct {
	GUID              string   `json:"guid" jsonschema:"pass to the grab_release tool together with indexerId"`
	IndexerID         int      `json:"indexerId"`
	Indexer           string   `json:"indexer,omitempty"`
	Title             string   `json:"title"`
	Quality           string   `json:"quality,omitempty"`
	Size              int64    `json:"size,omitempty" jsonschema:"release size in bytes"`
	Seeders           *int     `json:"seeders,omitempty" jsonschema:"torrents only; absent for usenet"`
	Leechers          *int     `json:"leechers,omitempty"`
	Age               int      `json:"age,omitempty" jsonschema:"days since the release was published"`
	Protocol          string   `json:"protocol,omitempty" jsonschema:"usenet or torrent"`
	PublishDate       string   `json:"publishDate,omitempty"`
	Approved          bool     `json:"approved" jsonschema:"false when the service would reject this release"`
	Rejections        []string `json:"rejections,omitempty" jsonschema:"why the service would refuse it; grabbing anyway overrides these"`
	CustomFormatScore int      `json:"customFormatScore,omitempty"`
	ReleaseGroup      string   `json:"releaseGroup,omitempty"`
	SeasonNumber      *int     `json:"seasonNumber,omitempty" jsonschema:"Sonarr only"`
	FullSeason        bool     `json:"fullSeason,omitempty" jsonschema:"Sonarr only; true for a whole-season pack"`
}

ReleaseCandidate is one release an indexer offered, trimmed to what a caller needs to choose between them and then grab one. GUID and IndexerID together identify the release to the grab endpoint.

func RadarrListReleases added in v1.2.0

func RadarrListReleases(ctx context.Context, c *Client, movieID, limit int) ([]ReleaseCandidate, error)

RadarrListReleases runs an interactive indexer search for one movie.

func SonarrListReleases added in v1.2.0

func SonarrListReleases(ctx context.Context, c *Client, episodeID, seriesID, seasonNumber *int, limit int) ([]ReleaseCandidate, error)

SonarrListReleases runs an interactive indexer search for one episode, or for one season of a series. This is a real search against every configured indexer, not a cached listing.

type ReleaseProfile added in v0.3.0

type ReleaseProfile struct {
	ID        int      `json:"id"`
	Name      string   `json:"name,omitempty"`
	Enabled   bool     `json:"enabled"`
	Required  []string `json:"required,omitempty" jsonschema:"terms a release title must contain"`
	Ignored   []string `json:"ignored,omitempty" jsonschema:"terms that reject a release"`
	IndexerID int      `json:"indexerId,omitempty" jsonschema:"indexer this profile is limited to; 0 means all"`
	Tags      []int    `json:"tags,omitempty"`
}

ReleaseProfile accepts or rejects releases by term.

func CreateReleaseProfile added in v1.4.0

func CreateReleaseProfile(ctx context.Context, c *Client, in ReleaseProfileCreate) (ReleaseProfile, error)

CreateReleaseProfile adds a release profile.

The body mirrors what the shipped web UI seeds a new profile with -- enabled, with empty term and tag arrays and indexerId 0 -- because the service rejects a null where it expects a list.

func ListReleaseProfiles added in v0.3.0

func ListReleaseProfiles(ctx context.Context, c *Client) ([]ReleaseProfile, error)

ListReleaseProfiles returns the configured release term profiles.

func UpdateReleaseProfile added in v1.4.0

func UpdateReleaseProfile(ctx context.Context, c *Client, in ReleaseProfileUpdate) (ReleaseProfile, error)

UpdateReleaseProfile changes a release profile in place, reading the stored record first so the terms that were not replaced survive the write.

type ReleaseProfileCreate added in v1.4.0

type ReleaseProfileCreate struct {
	// Name identifies the profile.
	Name string
	// Enabled turns the profile on; a new profile is on unless this says not.
	Enabled *bool
	// Required are terms a release title must contain.
	Required []string
	// Ignored are terms that reject a release.
	Ignored []string
	// IndexerID limits the profile to one indexer; 0 means all of them.
	IndexerID *int
	// Tags limit the profile to the series carrying them.
	Tags []int
}

ReleaseProfileCreate describes a new release profile.

type ReleaseProfileUpdate added in v1.4.0

type ReleaseProfileUpdate struct {
	// ID is the profile to change.
	ID int
	// Name renames the profile.
	Name *string
	// Enabled turns the profile on or off.
	Enabled *bool
	// Required replaces the terms a release title must contain.
	Required []string
	// Ignored replaces the terms that reject a release.
	Ignored []string
	// IndexerID limits the profile to one indexer; 0 means all of them.
	IndexerID *int
	// Tags replace the tags the profile is limited to.
	Tags []int
}

ReleaseProfileUpdate changes one release profile. Every field is optional so an omitted one leaves that setting alone.

type RenamePreview added in v0.3.0

type RenamePreview struct {
	EpisodeFileID  int    `json:"episodeFileId,omitempty"`
	MovieFileID    int    `json:"movieFileId,omitempty"`
	SeasonNumber   *int   `json:"seasonNumber,omitempty"`
	EpisodeNumbers []int  `json:"episodeNumbers,omitempty"`
	ExistingPath   string `json:"existingPath"`
	NewPath        string `json:"newPath"`
}

RenamePreview is one file the service would rename, and where it would go.

func RadarrRenamePreview added in v0.3.0

func RadarrRenamePreview(ctx context.Context, c *Client, movieID int) ([]RenamePreview, error)

RadarrRenamePreview lists the files of one movie that do not match the naming config, and what they would be renamed to.

func SonarrRenamePreview added in v0.3.0

func SonarrRenamePreview(ctx context.Context, c *Client, seriesID int, seasonNumber *int) ([]RenamePreview, error)

SonarrRenamePreview lists the files whose names do not match the naming config, and what they would be renamed to. A nil season covers the series.

type RootFolder

type RootFolder struct {
	ID         int    `json:"id"`
	Path       string `json:"path"`
	FreeSpace  int64  `json:"freeSpace,omitempty" jsonschema:"free space in bytes"`
	Accessible bool   `json:"accessible"`
}

RootFolder is a library root path as needed when adding media.

func AddRootFolder added in v1.4.0

func AddRootFolder(ctx context.Context, c *Client, path string) (RootFolder, error)

AddRootFolder registers a library path with the service. The path is the service's own view of the filesystem, which in a container is the path inside the container rather than on the host.

func ListRootFolders

func ListRootFolders(ctx context.Context, c *Client) ([]RootFolder, error)

ListRootFolders returns the library root folders configured on an instance.

type SearchResult

type SearchResult struct {
	Title       string `json:"title"`
	GUID        string `json:"guid,omitempty" jsonschema:"release identity; pass it with indexerId to prowlarr_grab_release"`
	IndexerID   int    `json:"indexerId,omitempty"`
	Indexer     string `json:"indexer,omitempty"`
	Size        int64  `json:"size,omitempty" jsonschema:"release size in bytes"`
	Seeders     int    `json:"seeders,omitempty"`
	Protocol    string `json:"protocol,omitempty"`
	PublishDate string `json:"publishDate,omitempty"`
}

SearchResult is the trimmed view of a Prowlarr indexer search hit. GUID and IndexerID are what prowlarr_grab_release needs. downloadUrl is deliberately absent: most results carry one and it embeds the indexer's API key.

func ProwlarrSearch

func ProwlarrSearch(ctx context.Context, c *Client, query string, categories []int, limit int) ([]SearchResult, error)

ProwlarrSearch searches all configured indexers for query.

Prowlarr ignores the limit query parameter -- a two-result request against the live instance answered with 398 -- so the cap is applied here.

type SeasonSummary added in v1.2.0

type SeasonSummary struct {
	SeasonNumber      int     `json:"seasonNumber" jsonschema:"0 is specials"`
	Monitored         bool    `json:"monitored"`
	EpisodeCount      int     `json:"episodeCount"`
	EpisodeFileCount  int     `json:"episodeFileCount"`
	TotalEpisodeCount int     `json:"totalEpisodeCount,omitempty" jsonschema:"including unaired episodes"`
	SizeOnDisk        int64   `json:"sizeOnDisk,omitempty"`
	PercentOfEpisodes float64 `json:"percentOfEpisodes,omitempty"`
}

SeasonSummary is one season of a series with its file counts.

type Series

type Series struct {
	ID        int    `json:"id" jsonschema:"Sonarr's internal series id, used by other tools"`
	Title     string `json:"title"`
	Year      int    `json:"year,omitempty"`
	Status    string `json:"status,omitempty" jsonschema:"continuing, ended, or upcoming"`
	Monitored bool   `json:"monitored"`
	TVDBID    int    `json:"tvdbId,omitempty" jsonschema:"TheTVDB id, required when adding the series"`
}

Series is the trimmed view of a Sonarr series returned to MCP clients.

Sonarr's /api/v3/series objects carry ~40 fields each, including nested `seasons`, `images`, `ratings` and `statistics` blocks. A library of 200 shows serialised in full is well over a megabyte, which would swamp the model's context on a single list call and crowd out the actual conversation. So we project down to the fields a user is plausibly asking about.

TODO(field-selection): decide the exact field set. See ARR-MCP notes.

func SonarrAddSeries

func SonarrAddSeries(ctx context.Context, c *Client, req AddSeriesRequest) (Series, error)

SonarrAddSeries adds a series to the library and returns the created record.

func SonarrEditSeries added in v0.3.0

func SonarrEditSeries(ctx context.Context, c *Client, req SeriesEditRequest) ([]Series, error)

SonarrEditSeries applies a change to a set of series at once. This is how monitoring, quality profiles, tags and the root folder are changed: the endpoint takes a partial resource, so nothing the caller omits is touched.

func SonarrListSeries

func SonarrListSeries(ctx context.Context, c *Client) ([]Series, error)

SonarrListSeries returns every series in the library.

func SonarrLookupSeries

func SonarrLookupSeries(ctx context.Context, c *Client, term string) ([]Series, error)

SonarrLookupSeries searches configured indexers for series matching term.

func SonarrSetSeasonMonitored added in v0.3.0

func SonarrSetSeasonMonitored(ctx context.Context, c *Client, seriesID, seasonNumber int, monitored bool) (Series, error)

SonarrSetSeasonMonitored monitors or unmonitors one season of a series.

There is no endpoint for a single season: seasons live inside the series resource, so the record is read back, the one season edited, and the whole thing written again. It is decoded into a map rather than a struct on purpose — a typed round trip would drop every field this package does not model and silently reset it on the instance.

type SeriesDetail added in v1.2.0

type SeriesDetail struct {
	ID               int             `json:"id"`
	Title            string          `json:"title"`
	Year             int             `json:"year,omitempty"`
	Status           string          `json:"status,omitempty"`
	Monitored        bool            `json:"monitored"`
	TVDBID           int             `json:"tvdbId,omitempty"`
	Path             string          `json:"path,omitempty"`
	RootFolderPath   string          `json:"rootFolderPath,omitempty"`
	QualityProfileID int             `json:"qualityProfileId,omitempty"`
	SeriesType       string          `json:"seriesType,omitempty" jsonschema:"standard, daily or anime"`
	SeasonFolder     bool            `json:"seasonFolder"`
	MonitorNewItems  string          `json:"monitorNewItems,omitempty"`
	Network          string          `json:"network,omitempty"`
	Runtime          int             `json:"runtime,omitempty" jsonschema:"minutes per episode"`
	Added            string          `json:"added,omitempty"`
	Tags             []int           `json:"tags,omitempty"`
	Seasons          []SeasonSummary `json:"seasons,omitempty"`
	Statistics       LibraryStats    `json:"statistics"`
}

SeriesDetail is one series with the per-season breakdown the list view omits. The overview, artwork, ratings and alternate titles are all dropped.

func SonarrGetSeries added in v1.2.0

func SonarrGetSeries(ctx context.Context, c *Client, id int) (SeriesDetail, error)

SonarrGetSeries returns one series with its seasons and library statistics.

type SeriesEditRequest added in v0.3.0

type SeriesEditRequest struct {
	SeriesIDs        []int  `json:"seriesIds"`
	Monitored        *bool  `json:"monitored,omitempty"`
	QualityProfileID *int   `json:"qualityProfileId,omitempty"`
	SeasonFolder     *bool  `json:"seasonFolder,omitempty"`
	RootFolderPath   string `json:"rootFolderPath,omitempty"`
	SeriesType       string `json:"seriesType,omitempty" jsonschema:"standard, daily or anime"`
	MonitorNewItems  string `json:"monitorNewItems,omitempty" jsonschema:"all or none"`
	Tags             []int  `json:"tags,omitempty"`
	ApplyTags        string `json:"applyTags,omitempty" jsonschema:"add, remove or replace"`
	MoveFiles        bool   `json:"moveFiles"`
}

SeriesEditRequest describes a bulk change to one or more series. Every field but SeriesIDs is optional upstream, so the optional ones are pointers or use omitempty: sending a zero value would reset a setting the caller never named.

type ServiceSpec

type ServiceSpec struct {
	// Name identifies the service in logs and errors.
	Name string
	// BasePath prefixes every request path, e.g. "/api/v3".
	BasePath string
	// StatusPath is the health endpoint, relative to BasePath.
	StatusPath string
	// Auth selects the credential scheme.
	Auth AuthKind
	// AuthHeader names the header for AuthHeaderKey; defaults to X-Api-Key.
	// Only the name is meaningful: net/http canonicalises header casing, so a
	// spec cannot request a differently-cased spelling of the same name.
	AuthHeader string
}

ServiceSpec describes how one service exposes its API. Keeping the base path and auth scheme here rather than in the shared client is what lets services with different API versions and headers share a single transport.

type ShareLimits added in v1.1.0

type ShareLimits struct {
	RatioLimit               *float64
	SeedingTimeLimit         *int
	InactiveSeedingTimeLimit *int
}

ShareLimits are per-torrent seeding limits. Nil fields are sent as -2, the global default, because the endpoint requires all three on every call.

type SubtitleBlacklistItem added in v1.1.0

type SubtitleBlacklistItem struct {
	SeriesTitle     string           `json:"seriesTitle,omitempty"`
	EpisodeTitle    string           `json:"episodeTitle,omitempty"`
	EpisodeNumber   string           `json:"episode_number,omitempty"`
	SonarrSeriesID  int              `json:"sonarrSeriesId,omitempty"`
	Title           string           `json:"title,omitempty" jsonschema:"movie title"`
	RadarrID        int              `json:"radarrId,omitempty"`
	Provider        string           `json:"provider"`
	SubsID          string           `json:"subs_id" jsonschema:"pass with provider to remove this entry"`
	Language        SubtitleLanguage `json:"language"`
	Timestamp       string           `json:"timestamp,omitempty"`
	ParsedTimestamp string           `json:"parsed_timestamp,omitempty"`
}

SubtitleBlacklistItem is a subtitle Bazarr has been told never to fetch again. Provider and SubsID together identify it for removal.

func BazarrBlacklist added in v1.1.0

func BazarrBlacklist(ctx context.Context, c *Client, kind string, start, length int) ([]SubtitleBlacklistItem, error)

BazarrBlacklist returns blacklisted subtitles for "episodes" or "movies".

Paging is applied here rather than upstream: GET /movies/blacklist answers 500 for any length above zero, because it calls .limit() on a result set it has already executed. Omitting the parameter is the only way to read it at all, and the episode endpoint is treated the same way so both behave alike.

type SubtitleCandidate added in v1.1.0

type SubtitleCandidate struct {
	Provider        string   `json:"provider" jsonschema:"pass back to the download tool unchanged"`
	Subtitle        string   `json:"subtitle" jsonschema:"opaque token identifying this result; pass back to the download tool unchanged"`
	Language        string   `json:"language"`
	Score           int      `json:"score" jsonschema:"match quality as a percentage"`
	HearingImpaired bool     `json:"hearingImpaired"`
	Forced          bool     `json:"forced"`
	OriginalFormat  bool     `json:"originalFormat"`
	Matches         []string `json:"matches,omitempty" jsonschema:"release attributes this subtitle matches"`
	DontMatches     []string `json:"dontMatches,omitempty" jsonschema:"release attributes it does not match"`
	ReleaseInfo     []string `json:"releaseInfo,omitempty" jsonschema:"releases the subtitle was timed for"`
	Uploader        string   `json:"uploader,omitempty"`
	URL             string   `json:"url,omitempty"`
}

SubtitleCandidate is one provider result from a manual subtitle search. Subtitle is opaque and only meaningful to the provider that produced it.

func BazarrManualSearchEpisode added in v1.1.0

func BazarrManualSearchEpisode(ctx context.Context, c *Client, episodeID int) ([]SubtitleCandidate, error)

BazarrManualSearchEpisode lists the subtitles providers currently offer for one episode, without downloading any of them.

func BazarrManualSearchMovie added in v1.1.0

func BazarrManualSearchMovie(ctx context.Context, c *Client, radarrID int) ([]SubtitleCandidate, error)

BazarrManualSearchMovie lists the subtitles providers currently offer for one movie, without downloading any of them.

type SubtitleFile added in v0.3.0

type SubtitleFile struct {
	Name   string `json:"name"`
	Code2  string `json:"code2"`
	Path   string `json:"path,omitempty" jsonschema:"file path, required to delete this subtitle; empty means the track is embedded"`
	Forced bool   `json:"forced"`
	HI     bool   `json:"hi"`
}

SubtitleFile is a subtitle already attached to an episode. Path is empty for tracks embedded in the media file, which cannot be deleted individually.

type SubtitleHistoryRecord added in v1.1.0

type SubtitleHistoryRecord struct {
	SeriesTitle     string           `json:"seriesTitle,omitempty"`
	EpisodeTitle    string           `json:"episodeTitle,omitempty"`
	EpisodeNumber   string           `json:"episode_number,omitempty" jsonschema:"season and episode, e.g. 1x7"`
	SonarrSeriesID  int              `json:"sonarrSeriesId,omitempty"`
	SonarrEpisodeID int              `json:"sonarrEpisodeId,omitempty"`
	Title           string           `json:"title,omitempty" jsonschema:"movie title"`
	RadarrID        int              `json:"radarrId,omitempty"`
	Action          int              `json:"action" jsonschema:"1 downloaded, 2 manually downloaded, 3 upgraded, 0 deleted"`
	Description     string           `json:"description,omitempty"`
	Provider        string           `json:"provider,omitempty"`
	SubsID          string           `json:"subs_id,omitempty" jsonschema:"provider-side subtitle id, required to blacklist it"`
	Language        SubtitleLanguage `json:"language"`
	Score           string           `json:"score,omitempty"`
	SubtitlesPath   string           `json:"subtitles_path,omitempty" jsonschema:"where the subtitle was written"`
	Timestamp       string           `json:"timestamp,omitempty" jsonschema:"relative, e.g. last month"`
	ParsedTimestamp string           `json:"parsed_timestamp,omitempty"`
	Upgradable      bool             `json:"upgradable,omitempty"`
	Blacklisted     bool             `json:"blacklisted,omitempty"`
}

SubtitleHistoryRecord is one subtitle download, upgrade or removal. The series fields are set for episode history and the movie fields for movie history; Provider, SubsID and SubtitlesPath are what the blacklist tools need to reject a bad subtitle.

func BazarrEpisodeHistory added in v1.1.0

func BazarrEpisodeHistory(ctx context.Context, c *Client, start, length, episodeID int) ([]SubtitleHistoryRecord, int, error)

BazarrEpisodeHistory returns subtitle history for episodes, newest first, with the total across all pages. A non-zero episodeID narrows it to one episode.

func BazarrMovieHistory added in v1.1.0

func BazarrMovieHistory(ctx context.Context, c *Client, start, length, radarrID int) ([]SubtitleHistoryRecord, int, error)

BazarrMovieHistory returns subtitle history for movies, newest first, with the total across all pages. A non-zero radarrID narrows it to one movie.

type SubtitleLanguage added in v0.3.0

type SubtitleLanguage struct {
	Name    string `json:"name"`
	Code2   string `json:"code2" jsonschema:"two-letter code, e.g. en"`
	Code3   string `json:"code3,omitempty"`
	Enabled bool   `json:"enabled"`
	Forced  bool   `json:"forced,omitempty"`
	HI      bool   `json:"hi,omitempty" jsonschema:"hearing impaired"`
}

SubtitleLanguage is a language Bazarr can fetch subtitles in.

func BazarrLanguages added in v0.3.0

func BazarrLanguages(ctx context.Context, c *Client, enabledOnly bool) ([]SubtitleLanguage, error)

BazarrLanguages returns Bazarr's languages. This endpoint returns a bare array rather than a data-wrapped object. Bazarr lists every ISO language, so enabledOnly filters to the ones actually configured.

type SubtitleMod added in v1.1.0

type SubtitleMod struct {
	// Action is "sync", "translate" or a subzero mod name.
	Action string
	// Language is the subtitle's two-letter code, or the target language when
	// translating.
	Language string
	// Path is the subtitle file to edit.
	Path string
	// MediaType is "episode" or "movie".
	MediaType string
	// MediaID is the sonarrEpisodeId or radarrId the subtitle belongs to.
	MediaID int
	// Forced marks the subtitle as forced.
	Forced bool
	// HI marks the subtitle as hearing impaired.
	HI bool
	// OriginalFormat keeps the subtitle's original format instead of srt.
	OriginalFormat bool
	// Reference is the sync reference: an audio track like "a:0" or a subtitle
	// file path. Empty means the video file itself.
	Reference string
	// MaxOffsetSeconds bounds how far a sync may shift the subtitle.
	MaxOffsetSeconds int
	// NoFixFramerate stops a sync from correcting the framerate.
	NoFixFramerate bool
	// GSS selects Golden-Section Search for a sync.
	GSS bool
}

SubtitleMod describes one edit to an existing subtitle file.

type SubtitleProvider added in v0.3.0

type SubtitleProvider struct {
	Name   string `json:"name"`
	Status string `json:"status,omitempty" jsonschema:"Good, or an error description"`
	Retry  string `json:"retry,omitempty"`
}

SubtitleProvider is a configured subtitle source and its current state.

func BazarrProviders added in v0.3.0

func BazarrProviders(ctx context.Context, c *Client) ([]SubtitleProvider, error)

BazarrProviders returns configured subtitle providers and their status.

type SubtitleTracks added in v1.1.0

type SubtitleTracks struct {
	AudioTracks       []AudioTrack            `json:"audio_tracks"`
	EmbeddedSubtitles []EmbeddedSubtitleTrack `json:"embedded_subtitles_tracks"`
	ExternalSubtitles []ExternalSubtitleTrack `json:"external_subtitles_tracks"`
}

SubtitleTracks lists what a media file contains alongside one subtitle: the audio and embedded tracks a sync can reference, plus the other external subtitle files.

func BazarrSubtitleTracks added in v1.1.0

func BazarrSubtitleTracks(ctx context.Context, c *Client, subtitlesPath string, episodeID, radarrID int) (SubtitleTracks, error)

BazarrSubtitleTracks lists the audio, embedded and external tracks beside one subtitle file. It answers a data-wrapped object rather than a list, and is the only place the track references a sync can use are visible.

type SystemStatus

type SystemStatus struct {
	Version      string `json:"version,omitempty"`
	AppName      string `json:"appName,omitempty"`
	InstanceName string `json:"instanceName,omitempty"`
}

SystemStatus is the trimmed health/version view of a service instance.

func GetSystemStatus

func GetSystemStatus(ctx context.Context, c *Client) (SystemStatus, error)

GetSystemStatus returns version and identity information for an instance.

type Tag added in v0.3.0

type Tag struct {
	ID    int    `json:"id"`
	Label string `json:"label"`
}

Tag is a label attached to series, movies, indexers and profiles.

func CreateTag added in v0.3.0

func CreateTag(ctx context.Context, c *Client, label string) (Tag, error)

CreateTag adds a tag and returns it with the id the service assigned.

func ListTags added in v0.3.0

func ListTags(ctx context.Context, c *Client) ([]Tag, error)

ListTags returns every tag configured on an instance.

func UpdateTag added in v1.2.0

func UpdateTag(ctx context.Context, c *Client, id int, label string) (Tag, error)

UpdateTag renames an existing tag, keeping everything that carries it.

type TagDetail added in v0.3.0

type TagDetail struct {
	ID                  int    `json:"id"`
	Label               string `json:"label"`
	MediaCount          int    `json:"mediaCount" jsonschema:"series or movies carrying this tag"`
	IndexerCount        int    `json:"indexerCount,omitempty"`
	DownloadClientCount int    `json:"downloadClientCount,omitempty"`
	ImportListCount     int    `json:"importListCount,omitempty"`
	NotificationCount   int    `json:"notificationCount,omitempty"`
	DelayProfileCount   int    `json:"delayProfileCount,omitempty"`
	ReleaseProfileCount int    `json:"releaseProfileCount,omitempty"`
	AutoTagCount        int    `json:"autoTagCount,omitempty"`
}

TagDetail reports how widely a tag is used. The upstream resource lists every tagged id, which on a real library is thousands of integers; the counts are what actually answer "is this tag still in use, and where?".

func ListTagDetails added in v0.3.0

func ListTagDetails(ctx context.Context, c *Client) ([]TagDetail, error)

ListTagDetails returns each tag with a count of what carries it.

type Task added in v0.3.0

type Task struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	TaskName      string `json:"taskName,omitempty" jsonschema:"the name to pass to the run_command tool"`
	Interval      int    `json:"interval,omitempty" jsonschema:"minutes between runs"`
	LastExecution string `json:"lastExecution,omitempty"`
	NextExecution string `json:"nextExecution,omitempty"`
}

Task is a scheduled background job.

func ListTasks added in v0.3.0

func ListTasks(ctx context.Context, c *Client) ([]Task, error)

ListTasks returns the scheduled background jobs and when they last ran.

type Torrent added in v1.1.0

type Torrent struct {
	Hash             string   `json:"hash"`
	Name             string   `json:"name"`
	State            string   `` /* 184-byte string literal not displayed */
	Progress         float64  `json:"progress" jsonschema:"fraction complete, 0 to 1"`
	Size             int64    `json:"size" jsonschema:"bytes selected for download"`
	Downloaded       int64    `json:"downloaded" jsonschema:"bytes downloaded"`
	Uploaded         int64    `json:"uploaded" jsonschema:"bytes uploaded"`
	DownloadSpeed    int64    `json:"downloadSpeed" jsonschema:"bytes per second"`
	UploadSpeed      int64    `json:"uploadSpeed" jsonschema:"bytes per second"`
	ETA              int64    `json:"eta" jsonschema:"seconds remaining; 8640000 means unknown"`
	Ratio            float64  `json:"ratio" jsonschema:"share ratio so far"`
	Category         string   `json:"category,omitempty"`
	Tags             []string `json:"tags,omitempty"`
	SavePath         string   `json:"savePath"`
	AddedOn          string   `json:"addedOn,omitempty" jsonschema:"RFC 3339 UTC"`
	CompletionOn     string   `json:"completionOn,omitempty" jsonschema:"RFC 3339 UTC; empty until the download finishes"`
	Seeds            int      `json:"seeds" jsonschema:"connected seeds"`
	Leechers         int      `json:"leechers" jsonschema:"connected leechers"`
	Priority         int      `json:"priority" jsonschema:"queue position; -1 when queueing is off or the torrent is not queued"`
	RatioLimit       float64  `json:"ratioLimit" jsonschema:"-2 global default, -1 unlimited"`
	SeedingTimeLimit int      `json:"seedingTimeLimit" jsonschema:"minutes; -2 global default, -1 unlimited"`
	DownloadLimit    int64    `json:"downloadLimit" jsonschema:"bytes per second; 0 unlimited"`
	UploadLimit      int64    `json:"uploadLimit" jsonschema:"bytes per second; 0 unlimited"`
}

Torrent is the trimmed view of one torrent. The upstream object carries about fifty fields including magnet URIs, tracker URLs and session counters; these are the ones that answer "what is it doing?".

func QBittorrentListTorrents added in v1.1.0

func QBittorrentListTorrents(ctx context.Context, c *Client, f TorrentFilter) ([]Torrent, error)

QBittorrentListTorrents lists torrents matching the filter.

type TorrentCategory added in v1.1.0

type TorrentCategory struct {
	Name     string `json:"name"`
	SavePath string `json:"savePath,omitempty" jsonschema:"empty means the default download path"`
}

TorrentCategory is a category with its optional save path.

func QBittorrentListCategories added in v1.1.0

func QBittorrentListCategories(ctx context.Context, c *Client) ([]TorrentCategory, error)

QBittorrentListCategories lists categories sorted by name. The upstream response is an object keyed by category name.

type TorrentFile added in v1.1.0

type TorrentFile struct {
	Index    int     `json:"index"`
	Name     string  `json:"name" jsonschema:"path relative to the torrent's save path"`
	Size     int64   `json:"size" jsonschema:"bytes"`
	Progress float64 `json:"progress" jsonschema:"fraction complete, 0 to 1"`
	Priority int     `json:"priority" jsonschema:"0 do not download, 1 normal, 6 high, 7 maximal"`
}

TorrentFile is one file inside a torrent.

func QBittorrentTorrentFiles added in v1.1.0

func QBittorrentTorrentFiles(ctx context.Context, c *Client, hash string) ([]TorrentFile, error)

QBittorrentTorrentFiles lists the files inside one torrent.

type TorrentFilter added in v1.1.0

type TorrentFilter struct {
	Filter   string
	Category *string
	Tag      *string
	Hashes   []string
	Limit    int
}

TorrentFilter narrows a torrent listing. Category and Tag are pointers because the empty string is meaningful to qBittorrent: category="" selects uncategorised torrents, whereas nil applies no category filter.

type TransferInfo added in v1.1.0

type TransferInfo struct {
	DownloadSpeed          int64  `json:"downloadSpeed" jsonschema:"bytes per second"`
	UploadSpeed            int64  `json:"uploadSpeed" jsonschema:"bytes per second"`
	DownloadLimit          int64  `json:"downloadLimit" jsonschema:"global limit in bytes per second; 0 unlimited"`
	UploadLimit            int64  `json:"uploadLimit" jsonschema:"global limit in bytes per second; 0 unlimited"`
	DHTNodes               int    `json:"dhtNodes"`
	ConnectionStatus       string `json:"connectionStatus" jsonschema:"connected, firewalled or disconnected"`
	AlternativeSpeedLimits bool   `json:"alternativeSpeedLimits" jsonschema:"whether the alternative speed limits are active"`
}

TransferInfo is the global transfer state.

func QBittorrentSetGlobalLimits added in v1.1.0

func QBittorrentSetGlobalLimits(ctx context.Context, c *Client, dl, up *int64, altMode *bool) (TransferInfo, error)

QBittorrentSetGlobalLimits sets the global speed limits and switches the alternative limits on or off. The mode endpoint is a toggle, so it is only called when the current state differs from the one requested. Returns the refreshed transfer state.

func QBittorrentTransferInfo added in v1.1.0

func QBittorrentTransferInfo(ctx context.Context, c *Client) (TransferInfo, error)

QBittorrentTransferInfo reports global speeds, limits and whether the alternative speed limits are active.

type UpdatePackage added in v0.3.0

type UpdatePackage struct {
	Version     string `json:"version"`
	Branch      string `json:"branch,omitempty"`
	ReleaseDate string `json:"releaseDate,omitempty"`
	Installed   bool   `json:"installed"`
	InstalledOn string `json:"installedOn,omitempty"`
	Installable bool   `json:"installable"`
	Latest      bool   `json:"latest"`
}

UpdatePackage is one release of the service. The changelog is deliberately dropped: it is several paragraphs per release and answers nothing a caller asks an *arr instance.

func ListUpdates added in v0.3.0

func ListUpdates(ctx context.Context, c *Client) ([]UpdatePackage, error)

ListUpdates returns the releases the service knows about.

type WantedEpisode added in v0.3.0

type WantedEpisode struct {
	SeriesTitle      string             `json:"seriesTitle"`
	EpisodeTitle     string             `json:"episodeTitle"`
	EpisodeNumber    string             `json:"episode_number" jsonschema:"season and episode, e.g. 8x1"`
	SonarrSeriesID   int                `json:"sonarrSeriesId"`
	SonarrEpisodeID  int                `json:"sonarrEpisodeId"`
	MissingSubtitles []SubtitleLanguage `json:"missing_subtitles"`
}

WantedEpisode is an episode missing one or more subtitle languages.

func BazarrWantedEpisodes added in v0.3.0

func BazarrWantedEpisodes(ctx context.Context, c *Client, start, length int) ([]WantedEpisode, int, error)

BazarrWantedEpisodes returns episodes missing subtitles, with the total count.

type WantedMovie added in v0.3.0

type WantedMovie struct {
	Title            string             `json:"title"`
	RadarrID         int                `json:"radarrId"`
	MissingSubtitles []SubtitleLanguage `json:"missing_subtitles"`
}

WantedMovie is a movie missing one or more subtitle languages.

func BazarrWantedMovies added in v0.3.0

func BazarrWantedMovies(ctx context.Context, c *Client, start, length int) ([]WantedMovie, int, error)

BazarrWantedMovies returns movies missing subtitles, with the total count.

Jump to

Keyboard shortcuts

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