SonarrAPI
- class arrapi.apis.sonarr.SonarrAPI(url: str, apikey: str, session: Session | None = None)[source]
Primary Class to use when connecting with the Sonarr API
- Parameters:
url (str) – URL of Sonarr application.
apikey (str) – apikey for the Sonarr application.
session (Optional[Session]) – Session object to use.
- respect_list_exclusions_when_adding()[source]
Stores all List Exclusions so whenever
add()
oradd_multiple_series()
is called the additions will be checked against the Exclusion List
- get_series(series_id: int | None = None, tvdb_id: int | None = None) Series [source]
Gets a
Series
by one of the IDs.
- all_series() List[Series] [source]
Gets all
Series
in Sonarr.- Returns:
List of Series in Sonarr.
- Return type:
List[
Series
]
- search_series(term: str) List[Series] [source]
Gets a list of
Series
by a search term.- Parameters:
term (str) – Term to Search for.
- Returns:
List of Series’s found.
- Return type:
List[
Series
]
- add_series(root_folder: str | int | RootFolder, quality_profile: str | int | QualityProfile, language_profile: str | int | LanguageProfile, series_id: int | None = None, tvdb_id: int | None = None, monitor: str = 'all', season_folder: bool = True, search: bool = True, unmet_search: bool = True, series_type: str = 'standard', tags: List[str | int | Tag] | None = None) Series [source]
Gets a
Series
by one of the IDs and adds it to Sonarr.- Parameters:
root_folder (Union[str, int, RootFolder]) – Root Folder for the Series.
quality_profile (Union[str, int, QualityProfile]) – Quality Profile for the Series.
language_profile (Union[str, int, LanguageProfile]) – Language Profile for the Series.
series_id (Optional[int]) – Search by Sonarr Series ID.
tvdb_id (Optional[int]) – Search by TVDb ID.
monitor (bool) – How to monitor the Series. Valid options are all, future, missing, existing, pilot, firstSeason, latestSeason, or none.
season_folder (bool) – Use Season Folders for the Series.
search (bool) – Start search for missing episodes of the Series after adding.
unmet_search (bool) – Start search for cutoff unmet episodes of the Series after adding.
series_type (str) – Series Type for the Series. Valid options are standard, daily, or anime.
tags (Optional[List[Union[str, int, Tag]]]) – Tags to be added to the Series.
- Returns:
Series for the ID given.
- Return type:
- Raises:
- edit_series(series_id: int | None = None, tvdb_id: int | None = None, path: str | None = None, move_files: bool = False, quality_profile: str | int | QualityProfile | None = None, language_profile: str | int | LanguageProfile | None = None, monitor: str | None = None, monitored: bool | None = None, season_folder: bool | None = None, series_type: str | None = None, tags: List[str | int | Tag] | None = None, apply_tags: str = 'add') Series [source]
Gets a
Series
by one of the IDs and edits it in Sonarr.- Parameters:
series_id (Optional[int]) – Search by Sonarr Series ID.
tvdb_id (Optional[int]) – Search by TVDb ID.
path (Optional[str]) – Path to change the Series to.
move_files (bool) – When changing the path do you want to move the files to the new path.
quality_profile (Optional[Union[str, int, QualityProfile]]) – Quality Profile to change the Series to.
language_profile (Optional[Union[str, int, LanguageProfile]]) – Language Profile to change the Series to.
monitor (Optional[str]) – How you want the Series monitored. Valid options are all, future, missing, existing, pilot, firstSeason, latestSeason, or none.
monitored (Optional[bool]) – Monitor the Series.
season_folder (Optional[bool]) – Use Season Folders for the Series.
series_type (Optional[str]) – Series Type to change the Series to. Valid options are standard, daily, or anime.
tags (Optional[List[Union[str, int, Tag]]]) – Tags to be added, replaced, or removed from the Series.
apply_tags (str) – How you want to edit the Tags. Valid options are add, replace, or remove.
- Returns:
Series for the ID given.
- Return type:
- Raises:
- delete_series(series_id: int | None = None, tvdb_id: int | None = None, addImportListExclusion: bool = False, deleteFiles: bool = False) Series [source]
Gets a
Series
by one of the IDs and deletes it from Sonarr.- Parameters:
series_id (Optional[int]) – Search by Sonarr Series ID.
tvdb_id (Optional[int]) – Search by TVDb ID.
addImportListExclusion (bool) – Add Import Exclusion for this Series.
deleteFiles (bool) – Delete Files for this Series.
- Returns:
Series for the ID given.
- Return type:
- Raises:
ValueError – When no ID is given.
NotFound – When there’s no series with that ID or when the Series hasn’t been added to Sonarr.
- add_multiple_series(ids: List[Series | int | Tuple[Series | int, str]], root_folder: str | int | RootFolder, quality_profile: str | int | QualityProfile, language_profile: str | int | LanguageProfile | None = None, monitor: str = 'all', season_folder: bool = True, search: bool = True, unmet_search: bool = True, series_type: str = 'standard', tags: List[str | int | Tag] | None = None, per_request: int = None) Tuple[List[Series], List[Series], List[int | Series], List[int]] [source]
Adds multiple Series to Sonarr in a single call by their TVDb IDs.
You can specify the path for each TVDb ID using a tuple in the list instead of just the ID ex.
(121361, "/media/Game of Thrones/")
The path provided must begin with the root_folder specified.
- Parameters:
ids (List[Union[Series, int, Tuple[Union[Series, int], str]]]) – List of TVDB IDs or Series lookups to add.
root_folder (Union[str, int, RootFolder]) – Root Folder for the Series.
quality_profile (Union[str, int, QualityProfile]) – Quality Profile for the Series.
language_profile (Optional[Union[str, int, LanguageProfile]]) – Language Profile for the Series. Required for older versions only.
monitor (bool) – How to monitor the Series. Valid options are
all
,future
,missing
,existing
,pilot
,firstSeason
,latestSeason
, ornone
.season_folder (bool) – Use Season Folders for the Series.
search (bool) – Start search for missing episodes of the Series after adding.
unmet_search (bool) – Start search for cutoff unmet episodes of the Series after adding.
series_type (str) – Series Type for the Series. Valid options are
standard
,daily
, oranime
.tags (Optional[List[Union[str, int, Tag]]]) – Tags to be added to the Series.
per_request (int) – Number of Series to add per request.
- Returns:
List of Series that were able to be added, List of Series already in Sonarr, List of Series that could not be found, List of Movies that were excluded.
- Return type:
Tuple[List[
Series
], List[Series
], List[Union[int, Series]], List[int]]- Raises:
Invalid – When one of the options given is invalid.
- edit_multiple_series(ids: List[int | Series], root_folder: str | int | RootFolder | None = None, move_files: bool = False, quality_profile: str | int | QualityProfile | None = None, language_profile: str | int | LanguageProfile | None = None, monitor: str | None = None, monitored: bool | None = None, season_folder: bool | None = None, series_type: str | None = None, tags: List[str | int | Tag] | None = None, apply_tags: str = 'add', per_request: int = None) Tuple[List[Series], List[int | Series]] [source]
Edit multiple Series in Sonarr by their TVDb IDs.
- Parameters:
ids (List[Union[int, Series]]) – List of Series IDs or Series objects you want to edit.
root_folder (Union[str, int, RootFolder]) – Root Folder to change the Series to.
move_files (bool) – When changing the root folder do you want to move the files to the new path.
quality_profile (Optional[Union[str, int, QualityProfile]]) – Quality Profile to change the Series to.
language_profile (Optional[Union[str, int, LanguageProfile]]) – Language Profile to change the Series to.
monitor (Optional[str]) – How you want the Series monitored. Valid options are all, future, missing, existing, pilot, firstSeason, latestSeason, or none.
monitored (Optional[bool]) – Monitor the Series.
season_folder (Optional[bool]) – Use Season Folders for the Series.
series_type (Optional[str]) – Series Type to change the Series to. Valid options are standard, daily, or anime.
tags (Optional[List[Union[str, int, Tag]]]) – Tags to be added, replaced, or removed from the Series.
apply_tags (str) – How you want to edit the Tags. Valid options are add, replace, or remove.
per_request (int) – Number of Series to edit per request.
- Returns:
List of Series that were able to be edited, List of Series that could not be found in Sonarr.
- Return type:
Tuple[List[
Series
], List[Union[Series, int]]]- Raises:
Invalid – When one of the options given is invalid.
- delete_multiple_series(ids: List[int | Series], addImportExclusion: bool = False, deleteFiles: bool = False, per_request: int = None) List[int | Series] [source]
Deletes multiple Series in Sonarr by their TVDb IDs.
- Parameters:
ids (List[Union[int, Series]]) – List of TVDb IDs or Series objects you want to delete.
addImportExclusion (bool) – Add Import Exclusion for these TVDb IDs.
deleteFiles (bool) – Delete Files for these TVDb IDs.
per_request (int) – Number of Series to delete per request.
- Returns:
List of Series that could not be found in Sonarr.
- Return type:
List[Union[Series, int]]
- language_profile() List[LanguageProfile] [source]
Gets every
LanguageProfile
in Sonarr.- Returns:
List of all Language Profiles
- Return type:
List[
LanguageProfile
]
- add_root_folder(path)
Adds the path given as a root folder
- Parameters:
path (str) – path of new root folder
- Raises:
ArrException – When the path does not exist or is already a root folder
- all_commands() List[Command]
Gets a list of
Command
.- Returns:
List of Commands
- Return type:
List[
Command
]
- all_tags(detail: bool = False) List[Tag]
Gets every
Tag
.- Parameters:
detail (bool) – Get Tags with details.
- Returns:
List of all Tags.
- Return type:
List[
Tag
]
- create_tag(label: str) Tag
Create a new
Tag
.- Parameters:
label (str) – Label of new Tag.
- Returns:
Tag just created.
- Return type:
- delete_tag(tag_id: int) None
Delete a
Tag
by its ID.- Parameters:
tag_id (int) – ID of tag to delete.
- Raises:
NotFound – When there’s no tag with that ID.
- quality_profile() List[QualityProfile]
Gets every
QualityProfile
.- Returns:
List of all Quality Profiles
- Return type:
List[
QualityProfile
]
- remote_path_mapping() List[RemotePathMapping]
Gets every
RemotePathMapping
.- Returns:
List of all Remote Path Mappings.
- Return type:
List[
RemotePathMapping
]
- root_folder() List[RootFolder]
Gets every
RootFolder
.- Returns:
List of all Root Folders.
- Return type:
List[
RootFolder
]
- system_status() SystemStatus
Gets the
SystemStatus
.- Returns:
System Status Information.
- Return type: