Sonarrο
Note
An asynchronous version of this client is available as AsyncSonarr.
The API is identical, but all methods are coroutines and must be awaited.
- class pyarr._sync.sonarr.Sonarr(host: str, api_key: str, port: int = 8989, tls: bool = True, base_path: str = '', request_timeout: int | None = None, api_ver: str | None = None)[source]ο
Sonarr API client.
Seriesο
- class pyarr._sync.sonarr.series.Series(handler: RequestHandler)[source]ο
Series actions for Sonarr.
- get(item_id: int | None = None, tvdb: bool = False, tmdb: bool = False) list[dict[str, Any]] | dict[str, Any][source]ο
Returns the list of added series or a specific series by ID, TVDB ID, or TMDB ID.
- Parameters:
item_id (int | None, optional) β ID of the series to return. Defaults to None.
tvdb (bool, optional) β Set to true if item_id is the TVDB ID. Defaults to False.
tmdb (bool, optional) β Set to true if item_id is the TMDB ID. Defaults to False.
- Returns:
List of dictionaries with items or a single dictionary.
- Return type:
JsonArray | JsonObject
- add(series: dict[str, Any], quality_profile_id: int, language_profile_id: int, root_dir: str, season_folder: bool = True, monitored: bool = True, ignore_episodes_with_files: bool = False, ignore_episodes_without_files: bool = False, search_for_missing_episodes: bool = False) dict[str, Any][source]ο
Adds a new series to your collection.
- Parameters:
series (JsonObject) β A series object from lookup().
quality_profile_id (int) β Database id for quality profile.
language_profile_id (int) β Database id for language profile.
root_dir (str) β Root folder location.
season_folder (bool, optional) β Create a folder for each season. Defaults to True.
monitored (bool, optional) β Monitor this series. Defaults to True.
ignore_episodes_with_files (bool, optional) β Ignore any episodes with existing files. Defaults to False.
ignore_episodes_without_files (bool, optional) β Ignore any episodes without existing files. Defaults to False.
search_for_missing_episodes (bool, optional) β Search for missing episodes to download. Defaults to False.
- Returns:
Dictionary of added record.
- Return type:
JsonObject
- update(data: dict[str, Any]) dict[str, Any][source]ο
Updates a series in the database.
- Parameters:
data (JsonObject) β data to update series.
- Returns:
updated series.
- Return type:
JsonObject
- delete(item_id: int, delete_files: bool = False) bool[source]ο
Delete a series from the database.
- Parameters:
item_id (int) β series id.
delete_files (bool, optional) β Also delete files associated with the series. Defaults to False.
- Returns:
True if series was deleted.
- Return type:
bool
- lookup(term: str | None = None, item_id: int | None = None) list[dict[str, Any]][source]ο
Searches for new shows on TheTVDB.com.
- Parameters:
term (Optional[str], optional) β Seriesβ Name.
item_id (Optional[int], optional) β TVDB ID for series.
- Returns:
List of dictionaries with items.
- Return type:
JsonArray
Episodeο
- class pyarr._sync.sonarr.episode.Episode(handler: RequestHandler)[source]ο
Episode actions for Sonarr.
- get(item_id: int | None = None, series_id: int | None = None) list[dict[str, Any]] | dict[str, Any][source]ο
Returns episodes by ID or series ID.
- Parameters:
item_id (int | None, optional) β ID for Episode. Defaults to None.
series_id (int | None, optional) β ID for Series. Defaults to None.
- Returns:
List of dictionaries with items or a single dictionary.
- Return type:
JsonArray | JsonObject
- update(item_id: int, data: dict[str, Any]) dict[str, Any][source]ο
Update the given episode.
- Parameters:
item_id (int) β ID of the Episode to be updated.
data (JsonObject) β Parameters to update the episode.
- Returns:
Dictionary with updated record.
- Return type:
JsonObject
- monitor(episode_ids: list[int], monitored: bool = True) list[dict[str, Any]][source]ο
Update episode monitored status.
- Parameters:
episode_ids (list[int]) β All episode IDs to be updated.
monitored (bool, optional) β True or False. Defaults to True.
- Returns:
list of dictionaries containing updated records.
- Return type:
JsonArray
Episode Fileο
- class pyarr._sync.sonarr.episode_file.EpisodeFile(handler: RequestHandler)[source]ο
Episode file actions for Sonarr.
- get(item_id: int | None = None, series_id: int | None = None) list[dict[str, Any]] | dict[str, Any][source]ο
Returns episode file information.
- Parameters:
item_id (int | None, optional) β Database id of episode file. Defaults to None.
series_id (int | None, optional) β Database id of series. Defaults to None.
- Returns:
List of dictionaries with items or a single dictionary.
- Return type:
JsonArray | JsonObject
Releaseο
- class pyarr._sync.sonarr.release.Release(handler: RequestHandler)[source]ο
Release actions for Sonarr.
- get(episode_id: int | None = None) list[dict[str, Any]][source]ο
Query indexers for latest releases.
- Parameters:
episode_id (int | None, optional) β Database id for episode to check. Defaults to None.
- Returns:
List of dictionaries with items.
- Return type:
JsonArray
- add(guid: str, indexer_id: int) dict[str, Any][source]ο
Adds a previously searched release to the download client.
- Parameters:
guid (str) β Recently searched result guid.
indexer_id (int) β Database id of indexer to use.
- Returns:
Dictionary with download release details.
- Return type:
JsonObject
- push(title: str, download_url: str, protocol: str, publish_date: datetime) list[dict[str, Any]][source]ο
If the title is wanted, Sonarr will grab it.
- Parameters:
title (str) β Release name.
download_url (str) β .torrent file URL.
protocol (str) β βUsenetβ or βTorrentβ.
publish_date (datetime) β ISO8601 date.
- Returns:
List of dictionaries with items.
- Return type:
JsonArray
Manual Importο
- class pyarr._sync.sonarr.manual_import.ManualImport(handler: RequestHandler)[source]ο
Manual import actions for Sonarr.
- get(folder: str, download_id: str | None = None, series_id: int | None = None, filter_existing_files: bool = True, replace_existing_files: bool = True) list[dict[str, Any]][source]ο
Gets a manual import list.
- Parameters:
folder (str) β Folder name.
download_id (str | None, optional) β Download ID. Defaults to None.
series_id (int | None, optional) β Series Database ID. Defaults to None.
filter_existing_files (bool, optional) β Filter files. Defaults to True.
replace_existing_files (bool, optional) β Replace files. Defaults to True.
- Returns:
List of dictionaries with items.
- Return type:
JsonArray