arr

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package arr talks to Radarr (movies) and Sonarr (TV), the apps many people run next to their media server to find and download what they watch. Matinee uses them to add titles people ask for, list what's coming soon, change a title's quality profile and replace a bad file.

It's a built-in integration. Everything Matinee needs from these apps goes through Client, so the rest of the server doesn't know their APIs, and the integration can move behind the plugin framework later without the HTTP API changing.

Index

Constants

This section is empty.

Variables

View Source
var Apps = []App{Radarr, Sonarr}

Apps lists the apps Matinee connects to.

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

ErrNotFound means the app doesn't have the title.

Functions

func NormalizeURL

func NormalizeURL(raw string) (string, error)

NormalizeURL accepts an address the way people type it, such as "radarr:7878" or "https://example.com/sonarr/".

Types

type AddOptions

type AddOptions struct {
	QualityProfileID int
	RootFolder       string
}

AddOptions say how to add a title.

type App

type App string

App is one of the apps Matinee connects to.

const (
	Radarr App = "radarr" // movies
	Sonarr App = "sonarr" // TV shows
)

func ParseApp

func ParseApp(s string) (App, bool)

ParseApp reads an app's name, as used in URLs.

func (App) Name

func (a App) Name() string

Name is the app's name as people know it.

type Client

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

Client calls one app's API (v3, which current Radarr and Sonarr both serve).

func New

func New(app App, c Config) (*Client, error)

func (*Client) Add

func (c *Client) Add(ctx context.Context, id int, opt AddOptions) (Title, error)

Add adds a title, by TMDB id for movies or TVDB id for shows, and starts searching for it. A title the app already has is left as it is.

func (*Client) Calendar

func (c *Client) Calendar(ctx context.Context, from, to time.Time) ([]Upcoming, error)

Calendar lists what's due between from and to that the app is waiting for: monitored titles without a file yet.

func (*Client) Find

func (c *Client) Find(ctx context.Context, tmdbID int, title string, year int) (Title, error)

Find looks for a title the app already has: by TMDB id, else by title and year (for libraries looked up without TMDB, and Sonarr versions that don't know TMDB ids).

func (*Client) Lookup

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

Lookup describes one title, by TMDB id for movies or TVDB id for shows.

func (*Client) QualityProfiles

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

func (*Client) ReplaceEpisode

func (c *Client) ReplaceEpisode(ctx context.Context, seriesID, season, episode int) error

ReplaceEpisode deletes an episode's file and searches for another copy.

func (*Client) ReplaceMovie

func (c *Client) ReplaceMovie(ctx context.Context, movie Title) error

ReplaceMovie deletes a movie's file and searches for another copy.

func (*Client) RootFolders

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

func (*Client) Search

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

Search looks titles up online through the app, the way its own Add New page does. Titles the app already has come back with their ID set.

func (*Client) SetQualityProfile

func (c *Client) SetQualityProfile(ctx context.Context, id, profileID int, search bool) error

SetQualityProfile changes a title's quality profile and, with search, looks for copies that match it.

func (*Client) Status

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

Status checks the address and key reach the app this client is for.

When the app redirects to its own URL base on the same host (or from http to https there), the client moves to that address; URL then reports it. Redirects elsewhere aren't followed, since they'd carry the API key along.

func (*Client) URL

func (c *Client) URL() string

URL is the app's address, as Status found it.

type Config

type Config struct {
	URL    string `json:"url"`
	APIKey string `json:"apiKey"`
	// What titles added from Matinee get, unless whoever adds one picks another profile.
	QualityProfileID int    `json:"qualityProfileId"`
	RootFolder       string `json:"rootFolder"`
}

Config is how Matinee reaches one app, set by an admin. The API key stays on the server.

type Error

type Error struct {
	Status  int
	Message string
	// contains filtered or unexported fields
}

Error is a failed call, with a message fit to show an admin.

func (*Error) Error

func (e *Error) Error() string

type QualityProfile

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

type RootFolder

type RootFolder struct {
	Path      string `json:"path"`
	FreeSpace int64  `json:"freeSpace"`
}

type Status

type Status struct {
	AppName string `json:"appName"`
	Version string `json:"version"`
}

Status is what an app says about itself.

type Title

type Title struct {
	ID               int    `json:"-"` // the app's own id; 0 when it hasn't added the title
	TMDBID           int    `json:"tmdbId,omitempty"`
	TVDBID           int    `json:"tvdbId,omitempty"`
	Title            string `json:"title"`
	Year             int    `json:"year,omitempty"`
	Overview         string `json:"overview,omitempty"`
	Poster           string `json:"poster,omitempty"`
	QualityProfileID int    `json:"-"`
	HasFile          bool   `json:"-"` // a movie's file is there
	FileID           int    `json:"-"`
}

Title is a movie (Radarr) or show (Sonarr).

type Upcoming

type Upcoming struct {
	Kind      string    `json:"kind"` // movie or episode
	Title     string    `json:"title"`
	Year      int       `json:"year,omitempty"`
	ShowTitle string    `json:"showTitle,omitempty"`
	Season    *int      `json:"season,omitempty"`
	Episode   *int      `json:"episode,omitempty"`
	Date      time.Time `json:"date"`
	// Release says what happens on Date: for movies cinemas, digital or
	// physical; for episodes airs.
	Release  string `json:"release"`
	Overview string `json:"overview,omitempty"`
	Poster   string `json:"poster,omitempty"`
	TMDBID   int    `json:"tmdbId,omitempty"`
}

Upcoming is a movie release or an episode airing.

Directories

Path Synopsis
Package arrtest is a pretend Radarr or Sonarr for tests: just enough of their v3 API for what Matinee calls.
Package arrtest is a pretend Radarr or Sonarr for tests: just enough of their v3 API for what Matinee calls.

Jump to

Keyboard shortcuts

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