sonarr

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2021 License: MIT Imports: 9 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddSeriesInput

type AddSeriesInput struct {
	ID                int64             `json:"id,omitempty"`
	TvdbID            int64             `json:"tvdbId"`
	QualityProfileID  int64             `json:"qualityProfileId"`
	LanguageProfileID int64             `json:"languageProfileID"`
	Tags              []int             `json:"tags"`
	RootFolderPath    string            `json:"rootFolderPath"`
	Title             string            `json:"title,omitempty"`
	SeriesType        string            `json:"seriesType,omitempty"`
	Seasons           []*Season         `json:"seasons"`
	AddOptions        *AddSeriesOptions `json:"addOptions"`
	SeasonFolder      bool              `json:"seasonFolder"`
	Monitored         bool              `json:"monitored"`
}

AddSeriesInput is the input for a POST to the /api/v3/series endpoint.

type AddSeriesOptions

type AddSeriesOptions struct {
	SearchForMissingEpisodes     bool `json:"searchForMissingEpisodes"`
	SearchForCutoffUnmetEpisodes bool `json:"searchForCutoffUnmetEpisodes,omitempty"`
	IgnoreEpisodesWithFiles      bool `json:"ignoreEpisodesWithFiles,omitempty"`
	IgnoreEpisodesWithoutFiles   bool `json:"ignoreEpisodesWithoutFiles,omitempty"`
}

AddSeriesOptions is part of AddSeriesInput.

type AddSeriesOutput

type AddSeriesOutput struct {
	ID                int64             `json:"id"`
	Title             string            `json:"title"`
	AlternateTitles   []*AlternateTitle `json:"alternateTitles"`
	SortTitle         string            `json:"sortTitle"`
	Status            string            `json:"status"`
	Overview          string            `json:"overview"`
	Network           string            `json:"network"`
	Images            []*starr.Image    `json:"images"`
	Seasons           []*Season         `json:"seasons"`
	Year              int               `json:"year"`
	Path              string            `json:"path"`
	QualityProfileID  int64             `json:"qualityProfileId"`
	LanguageProfileID int64             `json:"languageProfileId"`
	Runtime           int               `json:"runtime"`
	TvdbID            int64             `json:"tvdbId"`
	TvRageID          int64             `json:"tvRageId"`
	TvMazeID          int64             `json:"tvMazeId"`
	FirstAired        time.Time         `json:"firstAired"`
	SeriesType        string            `json:"seriesType"`
	CleanTitle        string            `json:"cleanTitle"`
	ImdbID            string            `json:"imdbId"`
	TitleSlug         string            `json:"titleSlug"`
	RootFolderPath    string            `json:"rootFolderPath"`
	Genres            []string          `json:"genres"`
	Tags              []int             `json:"tags"`
	Added             time.Time         `json:"added"`
	AddOptions        *AddSeriesOptions `json:"addOptions"`
	Ratings           *starr.Ratings    `json:"ratings"`
	Statistics        *Statistics       `json:"statistics"`
	Ended             bool              `json:"ended"`
	SeasonFolder      bool              `json:"seasonFolder"`
	Monitored         bool              `json:"monitored"`
	UseSceneNumbering bool              `json:"useSceneNumbering"`
}

AddSeriesOutput is currently an unknown format.

type AlternateTitle

type AlternateTitle struct {
	Title        string `json:"title"`
	SeasonNumber int    `json:"seasonNumber"`
}

AlternateTitle is part of a Series.

type CommandRequest added in v0.9.10

type CommandRequest struct {
	Name      string  `json:"name"`
	SeriesIDs []int64 `json:"seriesIds,omitempty"`
	SeriesID  int64   `json:"seriesId,omitempty"`
}

CommandReqyest goes into the /api/v3/command endpoint. This was created from the search command and may not support other commands yet.

type CommandResponse added in v0.9.10

type CommandResponse struct {
	ID                  int64                  `json:"id"`
	Name                string                 `json:"name"`
	CommandName         string                 `json:"commandName"`
	Message             string                 `json:"message,omitempty"`
	Priority            string                 `json:"priority"`
	Status              string                 `json:"status"`
	Queued              time.Time              `json:"queued"`
	Started             time.Time              `json:"started,omitempty"`
	Ended               time.Time              `json:"ended,omitempty"`
	StateChangeTime     time.Time              `json:"stateChangeTime,omitempty"`
	LastExecutionTime   time.Time              `json:"lastExecutionTime,omitempty"`
	Duration            string                 `json:"duration,omitempty"`
	Trigger             string                 `json:"trigger"`
	SendUpdatesToClient bool                   `json:"sendUpdatesToClient"`
	UpdateScheduledTask bool                   `json:"updateScheduledTask"`
	Body                map[string]interface{} `json:"body"`
}

CommandResponse comes from the /api/v3/command endpoint.

type Episode added in v0.10.2

type Episode struct {
	ID                       int64     `json:"id"`
	SeriesID                 int64     `json:"seriesId"`
	AbsoluteEpisodeNumber    int64     `json:"absoluteEpisodeNumber"`
	EpisodeFileID            int64     `json:"episodeFileId"`
	SeasonNumber             int64     `json:"seasonNumber"`
	EpisodeNumber            int64     `json:"episodeNumber"`
	AirDateUtc               time.Time `json:"airDateUtc"`
	AirDate                  string    `json:"airDate"`
	Title                    string    `json:"title"`
	Overview                 string    `json:"overview"`
	UnverifiedSceneNumbering bool      `json:"unverifiedSceneNumbering"`
	HasFile                  bool      `json:"hasFile"`
	Monitored                bool      `json:"monitored"`
}

Episode is the /api/v3/episode endpoint.

type Language

type Language struct {
	Language *starr.Value `json:"language"`
	Allowed  bool         `json:"allowed"`
}

Language is part of LanguageProfile.

type LanguageProfile

type LanguageProfile struct {
	Name           string       `json:"name"`
	UpgradeAllowed bool         `json:"upgradeAllowed"`
	Cutoff         *starr.Value `json:"cutoff"`
	Languages      []Language   `json:"languages"`
	ID             int64        `json:"id"`
}

LanguageProfile is the /api/v3/languageprofile endpoint.

type QualityProfile

type QualityProfile struct {
	ID             int64            `json:"id"`
	Name           string           `json:"name"`
	Cutoff         int64            `json:"cutoff"`
	Qualities      []*starr.Quality `json:"items"`
	UpgradeAllowed bool             `json:"upgradeAllowed"`
}

QualityProfile is the /api/v3/qualityprofile endpoint.

type Queue

type Queue struct {
	Page          int            `json:"page"`
	PageSize      int            `json:"pageSize"`
	SortKey       string         `json:"sortKey"`
	SortDirection string         `json:"sortDirection"`
	TotalRecords  int            `json:"totalRecords"`
	Records       []*QueueRecord `json:"records"`
}

Queue is the /api/v3/queue endpoint.

type QueueRecord

type QueueRecord struct {
	ID                      int64                  `json:"id"`
	SeriesID                int64                  `json:"seriesId"`
	EpisodeID               int64                  `json:"episodeId"`
	Language                *starr.Value           `json:"language"`
	Quality                 *starr.Quality         `json:"quality"`
	Size                    float64                `json:"size"`
	Title                   string                 `json:"title"`
	Sizeleft                float64                `json:"sizeleft"`
	Timeleft                string                 `json:"timeleft"`
	EstimatedCompletionTime time.Time              `json:"estimatedCompletionTime"`
	Status                  string                 `json:"status"`
	TrackedDownloadStatus   string                 `json:"trackedDownloadStatus"`
	TrackedDownloadState    string                 `json:"trackedDownloadState"`
	StatusMessages          []*starr.StatusMessage `json:"statusMessages"`
	DownloadID              string                 `json:"downloadId"`
	Protocol                string                 `json:"protocol"`
	DownloadClient          string                 `json:"downloadClient"`
	Indexer                 string                 `json:"indexer"`
	OutputPath              string                 `json:"outputPath"`
}

QueueRecord is part of Queue.

type ReleaseProfile added in v0.9.11

type ReleaseProfile struct {
	Name            string            `json:"name"`
	Required        string            `json:"required"`
	Ignored         string            `json:"ignored"`
	Preferred       []*starr.KeyValue `json:"preferred"`
	IncPrefOnRename bool              `json:"includePreferredWhenRenaming"`
	IndexerID       int64             `json:"indexerId"`
	Tags            []int             `json:"tags"`
	ID              int64             `json:"id"`
	Enabled         bool              `json:"enabled"`
}

type RootFolder

type RootFolder struct {
	ID              int64         `json:"id"`
	Path            string        `json:"path"`
	Accessible      bool          `json:"accessible"`
	FreeSpace       int64         `json:"freeSpace"`
	UnmappedFolders []*starr.Path `json:"unmappedFolders"`
}

RootFolder is the /api/v3/rootfolder endpoint.

type Season

type Season struct {
	SeasonNumber int         `json:"seasonNumber"`
	Monitored    bool        `json:"monitored"`
	Statistics   *Statistics `json:"statistics,omitempty"`
}

Season is part of Queue and used in a few places.

type Series

type Series struct {
	ID                int64             `json:"id"`
	Title             string            `json:"title,omitempty"`
	AlternateTitles   []*AlternateTitle `json:"alternateTitles,omitempty"`
	SortTitle         string            `json:"sortTitle,omitempty"`
	Status            string            `json:"status,omitempty"`
	Overview          string            `json:"overview,omitempty"`
	PreviousAiring    time.Time         `json:"previousAiring,omitempty"`
	Network           string            `json:"network,omitempty"`
	Images            []*starr.Image    `json:"images,omitempty"`
	Seasons           []*Season         `json:"seasons,omitempty"`
	Year              int               `json:"year,omitempty"`
	Path              string            `json:"path,omitempty"`
	QualityProfileID  int64             `json:"qualityProfileId,omitempty"`
	LanguageProfileID int64             `json:"languageProfileId,omitempty"`
	Runtime           int               `json:"runtime,omitempty"`
	TvdbID            int64             `json:"tvdbId,omitempty"`
	TvRageID          int64             `json:"tvRageId,omitempty"`
	TvMazeID          int64             `json:"tvMazeId,omitempty"`
	FirstAired        time.Time         `json:"firstAired,omitempty"`
	SeriesType        string            `json:"seriesType,omitempty"`
	CleanTitle        string            `json:"cleanTitle,omitempty"`
	ImdbID            string            `json:"imdbId,omitempty"`
	TitleSlug         string            `json:"titleSlug,omitempty"`
	RootFolderPath    string            `json:"rootFolderPath,omitempty"`
	Certification     string            `json:"certification,omitempty"`
	Genres            []string          `json:"genres,omitempty"`
	Tags              []int             `json:"tags,omitempty"`
	Added             time.Time         `json:"added,omitempty"`
	Ratings           *starr.Ratings    `json:"ratings,omitempty"`
	Statistics        *Statistics       `json:"statistics,omitempty"`
	NextAiring        time.Time         `json:"nextAiring,omitempty"`
	AirTime           string            `json:"airTime,omitempty"`
	Ended             bool              `json:"ended,omitempty"`
	SeasonFolder      bool              `json:"seasonFolder,omitempty"`
	Monitored         bool              `json:"monitored"`
	UseSceneNumbering bool              `json:"useSceneNumbering,omitempty"`
}

Series the /api/v3/series endpoint.

type SeriesLookup

type SeriesLookup struct {
	Title             string         `json:"title"`
	SortTitle         string         `json:"sortTitle"`
	Status            string         `json:"status"`
	Overview          string         `json:"overview"`
	Network           string         `json:"network"`
	AirTime           string         `json:"airTime"`
	Images            []*starr.Image `json:"images"`
	RemotePoster      string         `json:"remotePoster"`
	Seasons           []*Season      `json:"seasons"`
	Year              int            `json:"year"`
	QualityProfileID  int64          `json:"qualityProfileId"`
	LanguageProfileID int64          `json:"languageProfileId"`
	Runtime           int            `json:"runtime"`
	TvdbID            int64          `json:"tvdbId"`
	TvRageID          int64          `json:"tvRageId"`
	TvMazeID          int64          `json:"tvMazeId"`
	FirstAired        time.Time      `json:"firstAired"`
	SeriesType        string         `json:"seriesType"`
	CleanTitle        string         `json:"cleanTitle"`
	ImdbID            string         `json:"imdbId"`
	TitleSlug         string         `json:"titleSlug"`
	Folder            string         `json:"folder"`
	Certification     string         `json:"certification"`
	Genres            []string       `json:"genres"`
	Tags              []int          `json:"tags"`
	Added             time.Time      `json:"added"`
	Ratings           *starr.Ratings `json:"ratings"`
	Statistics        *Statistics    `json:"statistics"`
	Ended             bool           `json:"ended"`
	SeasonFolder      bool           `json:"seasonFolder"`
	Monitored         bool           `json:"monitored"`
	UseSceneNumbering bool           `json:"useSceneNumbering"`
}

SeriesLookup is the /api/v3/series/lookup endpoint.

type Sonarr

type Sonarr struct {
	starr.APIer
}

Sonarr contains all the methods to interact with a Sonarr server.

func New

func New(c *starr.Config) *Sonarr

New returns a Sonarr object used to interact with the Sonarr API.

func (*Sonarr) AddQualityProfile added in v0.9.11

func (s *Sonarr) AddQualityProfile(profile *QualityProfile) (int64, error)

AddQualityProfile updates a quality profile in place.

func (*Sonarr) AddReleaseProfile added in v0.9.11

func (s *Sonarr) AddReleaseProfile(profile *ReleaseProfile) (int64, error)

AddReleaseProfile updates a release profile in place.

func (*Sonarr) AddSeries

func (s *Sonarr) AddSeries(series *AddSeriesInput) (*AddSeriesOutput, error)

AddSeries adds a new series to Sonarr.

func (*Sonarr) AddTag

func (s *Sonarr) AddTag(label string) (int, error)

AddTag adds a tag or returns the ID for an existing tag.

func (*Sonarr) GetAllSeries

func (s *Sonarr) GetAllSeries() ([]*Series, error)

GetAllSeries returns all configured series. This may not deal well with pagination atm.

func (*Sonarr) GetCommands added in v0.9.10

func (s *Sonarr) GetCommands() ([]*CommandResponse, error)

GetCommands returns all available Sonarr commands. These can be used with SendCommand.

func (*Sonarr) GetLanguageProfiles

func (s *Sonarr) GetLanguageProfiles() ([]*LanguageProfile, error)

GetLanguageProfiles returns all configured language profiles.

func (*Sonarr) GetQualityProfiles

func (s *Sonarr) GetQualityProfiles() ([]*QualityProfile, error)

GetQualityProfiles returns all configured quality profiles.

func (*Sonarr) GetQueue added in v0.10.0

func (s *Sonarr) GetQueue(maxRecords, page int) (*Queue, error)

GetQueue returns the Sonarr Queue (processing, but not yet imported).

func (*Sonarr) GetReleaseProfiles added in v0.9.11

func (s *Sonarr) GetReleaseProfiles() ([]*ReleaseProfile, error)

GetReleaseProfiles returns all configured release profiles.

func (*Sonarr) GetRootFolders

func (s *Sonarr) GetRootFolders() ([]*RootFolder, error)

GetRootFolders returns all configured root folders.

func (*Sonarr) GetSeries

func (s *Sonarr) GetSeries(tvdbID int64) ([]*Series, error)

GetSeries locates and returns a series by tvdbID. If tvdbID is 0, returns all series.

func (*Sonarr) GetSeriesByID

func (s *Sonarr) GetSeriesByID(seriesID int64) (*Series, error)

GetSeriesByID locates and returns a series by DB [series] ID.

func (*Sonarr) GetSeriesEpisodes added in v0.10.2

func (s *Sonarr) GetSeriesEpisodes(seriesID int64) ([]*Episode, error)

GetSeriesEpisodes returns all episodes for a series by series ID. You can get series IDs from GetAllSeries() and GetSeries().

func (*Sonarr) GetSeriesLookup

func (s *Sonarr) GetSeriesLookup(term string, tvdbID int64) ([]*SeriesLookup, error)

GetSeriesLookup searches for a series [in Servarr] using a search term or a tvdbid. Provide a search term or a tvdbid. If you provide both, tvdbID is used.

func (*Sonarr) GetSystemStatus

func (s *Sonarr) GetSystemStatus() (*SystemStatus, error)

GetSystemStatus returns system status.

func (*Sonarr) GetTags

func (s *Sonarr) GetTags() ([]*starr.Tag, error)

GetTags returns all the tags.

func (*Sonarr) MonitorEpisode added in v0.10.2

func (s *Sonarr) MonitorEpisode(episodeIDs []int64, monitor bool) ([]*Episode, error)

MonitorEpisode sends a request to monitor (true) or unmonitor (false) a list of episodes by ID. You can get episode IDs from GetSeriesEpisodes().

func (*Sonarr) SendCommand added in v0.9.10

func (s *Sonarr) SendCommand(cmd *CommandRequest) (*CommandResponse, error)

SendCommand sends a command to Sonarr.

func (*Sonarr) UpdateQualityProfile added in v0.9.11

func (s *Sonarr) UpdateQualityProfile(profile *QualityProfile) error

UpdateQualityProfile updates a quality profile in place.

func (*Sonarr) UpdateReleaseProfile added in v0.9.11

func (s *Sonarr) UpdateReleaseProfile(profile *ReleaseProfile) error

UpdateReleaseProfile updates a release profile in place.

func (*Sonarr) UpdateSeries

func (s *Sonarr) UpdateSeries(seriesID int64, series *Series) error

UpdateSeries updates a series in place.

func (*Sonarr) UpdateTag

func (s *Sonarr) UpdateTag(tagID int, label string) (int, error)

UpdateTag updates the label for a tag.

type Statistics

type Statistics struct {
	SeasonCount       int       `json:"seasonCount"`
	PreviousAiring    time.Time `json:"previousAiring"`
	EpisodeFileCount  int       `json:"episodeFileCount"`
	EpisodeCount      int       `json:"episodeCount"`
	TotalEpisodeCount int       `json:"totalEpisodeCount"`
	SizeOnDisk        int64     `json:"sizeOnDisk"`
	PercentOfEpisodes float64   `json:"percentOfEpisodes"`
}

Statistics is part of Queue.

type SystemStatus

type SystemStatus struct {
	Version                string    `json:"version"`
	BuildTime              time.Time `json:"buildTime"`
	IsDebug                bool      `json:"isDebug"`
	IsProduction           bool      `json:"isProduction"`
	IsAdmin                bool      `json:"isAdmin"`
	IsUserInteractive      bool      `json:"isUserInteractive"`
	StartupPath            string    `json:"startupPath"`
	AppData                string    `json:"appData"`
	OsName                 string    `json:"osName"`
	OsVersion              string    `json:"osVersion"`
	IsMonoRuntime          bool      `json:"isMonoRuntime"`
	IsMono                 bool      `json:"isMono"`
	IsLinux                bool      `json:"isLinux"`
	IsOsx                  bool      `json:"isOsx"`
	IsWindows              bool      `json:"isWindows"`
	Mode                   string    `json:"mode"`
	Branch                 string    `json:"branch"`
	Authentication         string    `json:"authentication"`
	SqliteVersion          string    `json:"sqliteVersion"`
	URLBase                string    `json:"urlBase"`
	RuntimeVersion         string    `json:"runtimeVersion"`
	RuntimeName            string    `json:"runtimeName"`
	StartTime              time.Time `json:"startTime"`
	PackageVersion         string    `json:"packageVersion"`
	PackageAuthor          string    `json:"packageAuthor"`
	PackageUpdateMechanism string    `json:"packageUpdateMechanism"`
}

SystemStatus is the /api/v3/system/status endpoint.

Jump to

Keyboard shortcuts

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