pycliarr.api.base_media module

class pycliarr.api.base_media.BaseCliMediaApi(*args, default_root_folder_id: int = 0, **kwargs)[source]

Bases: pycliarr.api.base_api.BaseCliApi

Base class for media based API.

Implement behavior common to media based apis (e.g. sonarr, radarr)

add_item(json_data: Union[Dict[str, Any], List[Dict[str, Any]]]) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Adds a new item to collection

Parameters:json_data – Dict representation of the item to add
Returns:json response
api_url_base = '/api/v3'
api_url_blocklist = '/api/v3/blocklist'
api_url_calendar = '/api/v3/calendar'
api_url_command = '/api/v3/command'
api_url_diskspace = '/api/v3/diskspace'
api_url_exclusions = '/api/v3/importlistexclusion'
api_url_history = '/api/v3/history/'
api_url_item = '/api/v3/item'
api_url_itemlookup = '/api/v3/item/lookup'
api_url_language_profile = '/api/v3/languageProfile'
api_url_log = '/api/v3/log'
api_url_notification = '/api/v3/notification'
api_url_profile = '/api/v3/qualityProfile'
api_url_queue = '/api/v3/queue'
api_url_rootfolder = '/api/v3/rootfolder'
api_url_systembackup = '/api/v3/system/backup'
api_url_systemstatus = '/api/v3/system/status'
api_url_tag = '/api/v3/tag'
api_url_wanted_missing = '/api/v3/wanted/missing'
build_item_path(title: str, root_folder_id: int = 0) → pathlib.Path[source]

Build an item folder path using the root folder specified. :param title: Title to add to root path. All invalid characters are removed :type title: str :param root_folder_id: Id of the root folder (can be retrieved with get_root_folder()). :type root_folder_id: int :param If the id is not found or not specified, the default root folder id will be used.: :param If 0, the first root folder in the list is used.:

Returns: Full path of the serie in the format <root path>/<serie name>

create_tag(value: str) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Create the specified tag

Parameters:
  • item_id (int) – id of the tag to edit
  • value (str) – Tag label
Returns:

json response

default_root_folder_id
delete_blocklist(item_id: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Remove the specified item from the blocklist, or all items if none specified

Parameters:item_id (int) – Item to delete, None to delete all items
Returns:json response
delete_exclusion(item_id: int) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Remove the specified exclusions

Parameters:item_id (int) – id of the exclusions to delete
Returns:json response
delete_item(item_id: int, delete_files: bool = True, options: Dict[str, Any] = {}) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Delete the item with the given ID

Parameters:
  • item_id (int) – Item to delete
  • delete_files (bool) – Optional. Also delete files. Default is False
  • options (Dict[str, Any]) – Optionally specify additional options
Returns:

json response

delete_notification(item_id: int) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Remove the specified item from the blocklist, or all items if none specified

Parameters:item_id (int) – id of the notification to delete
Returns:json response
delete_queue(item_id: int, blacklist: Optional[bool] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Delete an item from the queue and download client. Optionally blacklist item after deletion.

Parameters:
  • item_id (int) – Item to delete
  • blacklist (Optional[bool]) – Optionally blacklist the item
Returns:

json response

delete_tag(item_id: int) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Remove the specified tag

Parameters:item_id (int) – id of the notification to delete
Returns:json response
edit_item(json_data: Union[Dict[str, Any], List[Dict[str, Any]]], url_params: Optional[Dict[str, Any]] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Edit an item from the collection

Parameters:json_data – Dict representation of the item to add
Returns:json response
edit_tag(item_id: int, value: str) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Edit the specified tag

Parameters:
  • item_id (int) – id of the tag to edit
  • value (str) – Tag label
Returns:

json response

get_backup() → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Return the backups as json

get_blocklist(page: int = 1, sort_key: str = 'date', page_size: int = 20, sort_dir: str = 'descending') → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get blocklisted releases

Parameters:
  • page (int) - 1-indexed (1 default) –
  • sort_key (string) –
  • page_size (int) – 20
  • sort_dir (string) – descending
get_calendar(start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Retrieve info about when items were/will be downloaded.

If start and end are not provided, retrieves movies airing today and tomorrow. :param start_date: Start date of events to retrieve :type start_date: Optional[datetime] :param end_date: End date of events to retrieve :type end_date: Optional[datetime]

Returns:json response
get_command(cid: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Query the status of a previously started command, or all currently running.

Parameters:cid (Optional[int]) –
Returns:json response
get_disk_space() → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Retrieve info about the disk space on the server.

Returns:json response
get_exclusion(item_id: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get import list exclusions

Parameters:item_id (int) – id of the exclusion to get, or None to get all of them
Returns:json response
get_history(page: int = 1, sort_key: str = 'date', page_size: int = 10, sort_dir: str = 'asc', options: Dict[str, Any] = {}) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get history (grabs/failures/completed)

Parameters:
  • page (int) - 1-indexed (1 default) –
  • sort_key (string) –
  • page_size (int) – 10
  • sort_dir (string) – asc
  • options (Dict[str, Any]={}) – Optional additional options
Returns:

json response

get_item(item_id: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get specified item, or all if no id provided from server collection.

Parameters:item_id (Optional[int]) –
Returns:json response
get_language_profiles() → List[Dict[str, Any]][source]

Return the quality profiles

get_logs(page: int = 1, sort_key: str = 'time', page_size: int = 10, sort_dir: str = 'asc') → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get logs

Parameters:
  • page (int) - 1-indexed (1 default) –
  • sort_key (string) –
  • page_size (int) – 10
  • sort_dir (string) – asc
Returns:

json response

get_notification(item_id: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get specified notification or all if none specified

Parameters:item_id (int) – id of the notification to get, or None to get all of them
Returns:json response
get_quality_profiles() → List[Dict[str, Any]][source]

Return the quality profiles

get_queue(page: int = 1, sort_key: str = 'progress', page_size: int = 20, sort_dir: str = 'ascending', include_unknown: bool = True) → Union[Dict[str, Any], List[Dict[str, Any]]][source]
get_root_folder() → List[Dict[str, Any]][source]

Retrieve the server root folder.

Returns:json response
get_system_status() → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Return the System Status as json

get_tag(item_id: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get specified tag or all if none specified

Parameters:item_id (int) – id of the tag to get, or None to get all of them
Returns:json response
get_tag_detail(item_id: Optional[int] = None) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get specified tag detail or all if none specified

Parameters:item_id (int) – id of the tag to get, or None to get all of them
Returns:json response
get_wanted(page: int = 1, sort_key: str = 'airDateUtc', page_size: int = 10, sort_dir: str = 'asc') → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Get Wanted / Missing episodes

Parameters:
  • sort_key (str) – series.title or airDateUtc (default)
  • page (int) – 1-indexed Default: 1
  • page_size (int) – Default: 10
  • sort_dir (str) – asc or desc - Default: asc
Returns:

json response

lookup_item(term: str) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Search for items

Parameters:term (str) – Lookup terms
Returns:json response
put_notification(item_id: int, notification_data: Union[Dict[str, Any], List[Dict[str, Any]]]) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Create the specified notification

Parameters:
Returns:

json response

rename_files(file_ids: List[int]) → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Rename the list of files provided.

Parameters:file_ids (List[int]) – List of ids of files to rename
Returns:json response
sync_rss() → Union[Dict[str, Any], List[Dict[str, Any]]][source]

Perform an RSS sync with all enabled indexers.

Returns:json response