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 ¶
- Variables
- func NormalizeURL(raw string) (string, error)
- func SettingKey(app App) string
- type AddOptions
- type App
- type Client
- func (c *Client) Add(ctx context.Context, id int, opt AddOptions) (Title, error)
- func (c *Client) Calendar(ctx context.Context, from, to time.Time) ([]Upcoming, error)
- func (c *Client) Find(ctx context.Context, tmdbID int, title string, year int) (Title, error)
- func (c *Client) Library(ctx context.Context) ([]Title, error)
- func (c *Client) Lookup(ctx context.Context, id int) (Title, error)
- func (c *Client) QualityProfiles(ctx context.Context) ([]QualityProfile, error)
- func (c *Client) ReplaceEpisode(ctx context.Context, seriesID, season, episode int) error
- func (c *Client) ReplaceMovie(ctx context.Context, movie Title) error
- func (c *Client) RootFolders(ctx context.Context) ([]RootFolder, error)
- func (c *Client) Search(ctx context.Context, term string) ([]Title, error)
- func (c *Client) SetQualityProfile(ctx context.Context, id, profileID int, search bool) error
- func (c *Client) Status(ctx context.Context) (Status, error)
- func (c *Client) URL() string
- type Config
- type Error
- type QualityProfile
- type RootFolder
- type Status
- type Title
- type Upcoming
Constants ¶
This section is empty.
Variables ¶
var Apps = []App{Radarr, Sonarr}
Apps lists the apps Matinee connects to.
var ErrNotFound = errors.New("not found")
ErrNotFound means the app doesn't have the title.
Functions ¶
func NormalizeURL ¶
NormalizeURL accepts an address the way people type it, such as "radarr:7878" or "https://example.com/sonarr/".
func SettingKey ¶ added in v0.2.2
SettingKey is the setting that holds an app's Config, as JSON.
Types ¶
type AddOptions ¶
AddOptions say how to add a title.
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 (*Client) Add ¶
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 ¶
Calendar lists what's due between from and to that the app is waiting for: monitored titles without a file yet.
func (*Client) Find ¶
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) QualityProfiles ¶
func (c *Client) QualityProfiles(ctx context.Context) ([]QualityProfile, error)
func (*Client) ReplaceEpisode ¶
ReplaceEpisode deletes an episode's file and searches for another copy.
func (*Client) ReplaceMovie ¶
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 ¶
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 ¶
SetQualityProfile changes a title's quality profile and, with search, looks for copies that match it.
func (*Client) Status ¶
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.
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 QualityProfile ¶
type RootFolder ¶
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"`
Backdrop string `json:"backdrop,omitempty"`
// Rating is out of 10; Genres are in English.
Rating float64 `json:"-"`
Genres []string `json:"-"`
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.