### Synchronous Sonarr Usage Example Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Demonstrates how to instantiate and use the synchronous Sonarr client. It requires host, API key, and port, then fetches and prints series information. ```python # Import Sonarr Class from pyarr import Sonarr # Set Host, API-Key and Port host = 'your-domain.com' api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' port = 8989 # Instantiate Sonarr Object sonarr = Sonarr(host, api_key, port) # Get and print TV Shows using the series component print(sonarr.series.get()) ``` -------------------------------- ### Install PyArr Package Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Installs the pyarr package from PyPI using pip. This is the first step to using the library in your Python projects. ```shell pip install pyarr ``` -------------------------------- ### Asynchronous Sonarr Usage Example Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Shows how to use the asynchronous Sonarr client with asyncio. It requires host, API key, and port, and fetches series data within an async context. ```python import asyncio # Import AsyncSonarr Class from pyarr import AsyncSonarr async def main(): # Set Host, API-Key and Port host = 'your-domain.com' api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' port = 8989 # Instantiate AsyncSonarr Object async with AsyncSonarr(host, api_key, port) as sonarr: # Get and print TV Shows using the series component print(await sonarr.series.get()) asyncio.run(main()) ``` -------------------------------- ### Initialize Lidarr Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates initializing a Lidarr client for music library management. The example includes client setup and then retrieves disk space information, iterating through the results to print the path and free space for each disk. ```python from pyarr import Lidarr lidarr = Lidarr( host="192.168.1.100", api_key="your-api-key-here", port=8686 ) # Check disk space diskspace = lidarr.system.get_diskspace() for disk in diskspace: print(f"Path: {disk['path']}, Free: {disk['freeSpace']}") ``` -------------------------------- ### Initialize Prowlarr Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt This example demonstrates initializing a Prowlarr client for managing indexers. It shows the client setup and then retrieves all configured indexers, printing the name of each indexer. ```python from pyarr import Prowlarr prowlarr = Prowlarr( host="192.168.1.100", api_key="your-api-key-here", port=9696 ) # Get all indexers indexers = prowlarr.indexer.get() for indexer in indexers: print(f"Indexer: {indexer['name']}") ``` -------------------------------- ### Initialize Bazarr Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Illustrates how to initialize a Bazarr client for subtitle management. The example includes client setup and then retrieves the list of available subtitle providers, printing their count. ```python from pyarr import Bazarr bazarr = Bazarr( host="192.168.1.100", api_key="your-api-key-here", port=6767 ) # Get subtitle providers providers = bazarr.providers.get() print(f"Available providers: {len(providers)}") ``` -------------------------------- ### Install Pyarr from Source Source: https://github.com/totaldebug/pyarr/blob/main/docs/installing.md Provides instructions for installing the pyarr package directly from its Git repository. This method is useful for development or when needing the latest unreleased version. It includes both direct pip installation and adding to a requirements.txt file. ```shell pip install -e https://github.com/totaldebug/pyarr.git#egg=pyarr ``` ```shell -e git+https://github.com/totaldebug/pyarr.git#egg=pyarr ``` -------------------------------- ### Import PyArr Modules Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Imports necessary modules from the pyarr library. This allows you to instantiate clients for various services like Sonarr, Radarr, and others. ```python from pyarr import Sonarr, Radarr, Readarr, Lidarr, Prowlarr, Bazarr, Whisparr, Dispatcharr ``` -------------------------------- ### Initialize Readarr Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Shows how to initialize a Readarr client for managing book and ebook libraries. The example demonstrates client setup and then fetches all authors, printing the total count. ```python from pyarr import Readarr readarr = Readarr( host="192.168.1.100", api_key="your-api-key-here", port=8787 ) # Get all authors authors = readarr.author.get() print(f"Total authors: {len(authors)}") ``` -------------------------------- ### PyArr Full URL Configuration Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Illustrates using a full URL for the host parameter, allowing PyArr to automatically parse the scheme, host, port, and subpath. This simplifies configuration when services are hosted on non-standard paths. ```python # All of these are valid ways to instantiate a client sonarr = Sonarr("http://192.168.1.100:8989/sonarr", api_key) sonarr = Sonarr("localhost", api_key, port=8989, tls=False) ``` -------------------------------- ### Initialize Sonarr Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to initialize a Sonarr client in Python. It covers basic initialization with host, API key, and port, as well as advanced options like full URL, SSL verification, custom headers, and timeouts. The example also shows using a context manager for automatic resource management. ```python from pyarr import Sonarr # Basic initialization sonarr = Sonarr( host="192.168.1.100", api_key="your-api-key-here", port=8989 ) # Advanced initialization with full URL and options sonarr = Sonarr( host="http://192.168.1.100:8989/sonarr", api_key="your-api-key-here", verify_ssl=False, # For self-signed certificates headers={"User-Agent": "MyApp/1.0"}, request_timeout=30 ) # Using context manager with Sonarr("localhost", "api-key", port=8989, tls=False) as sonarr: status = sonarr.system.get_status() print(f"Sonarr version: {status['version']}") ``` -------------------------------- ### Initialize Async Clients (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Shows how to initialize asynchronous clients for Sonarr and Radarr using `asyncio`. All methods on these clients must be `await`ed. The example uses context managers for both clients and demonstrates fetching series and movie data, as well as system health information. ```python import asyncio from pyarr import AsyncSonarr, AsyncRadarr async def main(): async with AsyncSonarr("192.168.1.100", "api-key", port=8989) as sonarr: # Get all series series = await sonarr.series.get() print(f"Total series: {len(series)}") # Get system health health = await sonarr.system.get_health() for issue in health: print(f"Health issue: {issue['message']}") async with AsyncRadarr("192.168.1.100", "api-key", port=7878) as radarr: movies = await radarr.movie.get() print(f"Total movies: {len(movies)}") asyncio.run(main()) ``` -------------------------------- ### PyArr Custom HTTP Session Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Demonstrates passing a custom httpx.AsyncClient session to the AsyncSonarr constructor. This is useful in environments like Home Assistant that manage their own HTTP sessions. ```python import httpx from pyarr import AsyncSonarr async with httpx.AsyncClient() as session: async with AsyncSonarr(host, api_key, session=session) as sonarr: print(await sonarr.series.get()) ``` -------------------------------- ### Initialize Radarr Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Initializes a Radarr client for managing movie libraries. This example shows basic client setup with host, API key, port, and TLS configuration, followed by fetching the system status to display the Radarr version. ```python from pyarr import Radarr radarr = Radarr( host="192.168.1.100", api_key="your-api-key-here", port=7878, tls=True ) # Get system status status = radarr.system.get_status() print(f"Radarr is running version {status['version']}") ``` -------------------------------- ### Import Pyarr Services Source: https://github.com/totaldebug/pyarr/blob/main/docs/installing.md Shows how to import the various arr services (Sonarr, Radarr, etc.) and their asynchronous counterparts from the pyarr library. This is the first step after installation to begin using the library's functionalities. ```python from pyarr import \ Sonarr, Radarr, Readarr, Lidarr, Prowlarr, Bazarr, Whisparr, Dispatcharr, \ AsyncSonarr, AsyncRadarr, AsyncReadarr, AsyncLidarr, AsyncProwlarr, AsyncBazarr, AsyncWhisparr, AsyncDispatcharr ``` -------------------------------- ### Manage Backups with Sonarr (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Provides examples for retrieving a list of existing backups, creating a new backup, and deleting a specific backup using the Sonarr API. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get all backups backups = sonarr.backup.get() for backup in backups: print(f"{backup['name']} - {backup['time']} - {backup['type']}") # Create a new backup result = sonarr.backup.create() print(f"Backup command started: {result['name']}") # Delete a backup sonarr.backup.delete(item_id=1) ``` -------------------------------- ### Manage Download Clients with Radarr API Source: https://context7.com/totaldebug/pyarr/llms.txt Shows how to configure and manage download clients (e.g., qBittorrent) in Radarr using pyarr. Examples cover retrieving existing clients, fetching schemas for different client types, configuring client settings from a schema, adding a new client, updating one, and deleting a client. Requires a Radarr instance. ```python from pyarr import Radarr radarr = Radarr("192.168.1.100", "api-key", port=7878) # Get all download clients clients = radarr.download_client.get() for client in clients: print(f"{client['name']} - {client['implementation']}") # Get schemas for available client types schemas = radarr.download_client.get_schema() # Get schema for specific implementation (e.g., qBittorrent) qbit_schemas = radarr.download_client.get_schema(implementation="QBittorrent") qbit_schema = qbit_schemas[0] # Configure the schema fields for field in qbit_schema['fields']: if field['name'] == 'host': field['value'] = '192.168.1.50' elif field['name'] == 'port': field['value'] = 8080 elif field['name'] == 'username': field['value'] = 'admin' elif field['name'] == 'password': field['value'] = 'password' qbit_schema['name'] = 'My qBittorrent' qbit_schema['enable'] = True # Add the download client new_client = radarr.download_client.add(data=qbit_schema) print(f"Added client: {new_client['name']}") # Update a client new_client['enable'] = False updated = radarr.download_client.update(item_id=new_client['id'], data=new_client) # Delete a client radarr.download_client.delete(item_id=new_client['id']) ``` -------------------------------- ### Install Pyarr using Package Managers Source: https://github.com/totaldebug/pyarr/blob/main/docs/installing.md Demonstrates how to install the pyarr Python package using common package managers like uv, poetry, and pip. These commands are essential for setting up the library in your project environment. ```shell uv add pyarr ``` ```shell poetry add pyarr ``` ```shell pip install pyarr ``` -------------------------------- ### Manage Root Folders with Sonarr and Lidarr APIs Source: https://context7.com/totaldebug/pyarr/llms.txt Illustrates how to manage root folders for media storage using pyarr. Examples cover fetching all root folders, adding new ones, and deleting them. It also shows additional parameters available when adding root folders specifically for Lidarr. Requires Sonarr or Lidarr instances. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get all root folders folders = sonarr.root_folder.get() for folder in folders: free_gb = folder['freeSpace'] / (1024**3) print(f"{folder['path']} - {free_gb:.1f}GB free") # Add a new root folder new_folder = sonarr.root_folder.add(path="/media/tv-shows") print(f"Added root folder: {new_folder['path']}") # Lidarr supports additional options from pyarr import Lidarr lidarr = Lidarr("192.168.1.100", "api-key", port=8686) new_folder = lidarr.root_folder.add( path="/media/music", name="Main Music Library", default_quality_profile_id=1, default_metadata_profile_id=1, default_tags=[1, 2] ) # Delete a root folder sonarr.root_folder.delete(item_id=new_folder['id']) ``` -------------------------------- ### Execute System Commands with Sonarr and Radarr (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to execute various system commands like refresh, search, and rescan using the Sonarr and Radarr APIs. It covers getting command status and executing specific actions. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get status of all commands commands = sonarr.command.get() for cmd in commands: print(f"{cmd['name']} - {cmd['status']}") # Get specific command status command = sonarr.command.get(item_id=1) print(f"Command: {command['name']}, Status: {command['status']}") # Execute commands # Refresh all series result = sonarr.command.execute(name="RefreshSeries") # Refresh specific series result = sonarr.command.execute(name="RefreshSeries", seriesId=1) # Search for missing episodes result = sonarr.command.execute(name="MissingEpisodeSearch") # Rescan series folder result = sonarr.command.execute(name="RescanSeries", seriesId=1) ``` ```python from pyarr import Radarr radarr = Radarr("192.168.1.100", "api-key", port=7878) # Refresh all movies radarr.command.execute(name="RefreshMovie") # Search for specific movie radarr.command.execute(name="MoviesSearch", movieIds=[1, 2, 3]) ``` -------------------------------- ### Manage Quality Profiles with Radarr API Source: https://context7.com/totaldebug/pyarr/llms.txt Provides examples for managing quality profiles in Radarr using the pyarr library. This includes fetching all profiles, retrieving a specific profile, getting the schema for creating new profiles, adding a new profile, updating an existing one, and deleting a profile. Requires a running Radarr instance with an API key. ```python from pyarr import Radarr radarr = Radarr("192.168.1.100", "api-key", port=7878) # Get all quality profiles profiles = radarr.quality_profile.get() for profile in profiles: print(f"ID: {profile['id']}, Name: {profile['name']}") # Get specific profile profile = radarr.quality_profile.get(item_id=1) print(f"Profile: {profile['name']}, Cutoff: {profile['cutoff']}") # Get quality profile schema (for creating new profiles) schema = radarr.quality_profile.get_schema() # Add a new quality profile new_profile = radarr.quality_profile.add(data={ "name": "Custom 4K", "upgradeAllowed": True, "cutoff": 22, # Quality ID for cutoff "items": schema['items'] # Use schema items }) # Update a quality profile profile['name'] = "Updated Profile Name" updated = radarr.quality_profile.update(item_id=1, data=profile) # Delete a quality profile radarr.quality_profile.delete(item_id=new_profile['id']) ``` -------------------------------- ### PyArr SSL Verification and Custom Headers Source: https://github.com/totaldebug/pyarr/blob/main/docs/quickstart.md Shows how to disable SSL verification and provide custom headers during client instantiation. Disabling SSL verification is useful for self-signed certificates, and custom headers can be used for identification or authentication. ```python sonarr = Sonarr( host, api_key, verify_ssl=False, headers={"User-Agent": "MyCustomApp/1.0"} ) ``` -------------------------------- ### Use Custom HTTP Session with Async Client (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to integrate Pyarr with an existing `httpx.AsyncClient` session. This is useful in environments like Home Assistant where HTTP sessions are managed externally. The example shows initializing `AsyncSonarr` with a provided session object. ```python import httpx from pyarr import AsyncSonarr async def with_custom_session(): async with httpx.AsyncClient(timeout=60.0) as session: async with AsyncSonarr( host="192.168.1.100", api_key="api-key", port=8989, session=session ) as sonarr: status = await sonarr.system.get_status() print(status) ``` -------------------------------- ### Handle Pyarr API Exceptions (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Illustrates how to handle various exceptions that can occur during Pyarr API operations, such as connection errors, unauthorized access, resource not found, and bad requests. Includes specific examples for missing arguments. ```python from pyarr import Sonarr from pyarr import ( PyarrConnectionError, PyarrUnauthorizedError, PyarrAccessRestricted, PyarrResourceNotFound, PyarrBadGateway, PyarrMissingProfile, PyarrMethodNotAllowed, PyarrRecordNotFound, PyarrMissingArgument, PyarrBadRequest, PyarrServerError, ) sonarr = Sonarr("192.168.1.100", "api-key", port=8989) try: series = sonarr.series.get(item_id=99999) except PyarrResourceNotFound: print("Series not found") except PyarrUnauthorizedError: print("Invalid API key") except PyarrConnectionError: print("Could not connect to Sonarr") except PyarrBadRequest as e: print(f"Bad request: {e}") except PyarrServerError as e: print(f"Server error: {e}, Response: {e.response}") # Missing argument example try: results = sonarr.series.lookup() # Missing required term or item_id except PyarrMissingArgument: print("Must provide either term or TVDB ID") ``` -------------------------------- ### Manage Tags with Sonarr API Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to get, create, update, and delete tags using the Sonarr API via the pyarr library. It shows how to retrieve tag details, create new tags, modify existing ones, and remove tags. Assumes a Sonarr instance is accessible and authenticated. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get tag with details (shows associated series/movies) tag_detail = sonarr.tag.get_detail(item_id=1) print(f"Tag '{tag_detail['label']}' is used by {len(tag_detail.get('seriesIds', []))} series") # Create a new tag new_tag = sonarr.tag.create(label="4K") print(f"Created tag: {new_tag['label']} with ID {new_tag['id']}") # Update a tag updated = sonarr.tag.update(item_id=new_tag['id'], label="4K-HDR") print(f"Updated tag to: {updated['label']}") # Delete a tag sonarr.tag.delete(item_id=new_tag['id']) ``` -------------------------------- ### Establish Async Connection to Sonarr and Radarr Source: https://github.com/totaldebug/pyarr/blob/main/test_async_live_environments.ipynb Demonstrates how to initialize an asynchronous client for Sonarr and Radarr to fetch system status and library information. It includes error handling to verify successful connectivity. ```python try: async with AsyncSonarr( host=SONARR_HOST, api_key=SONARR_API_KEY, port=SONARR_PORT, tls=SONARR_TLS, request_timeout=REQUEST_TIMEOUT ) as sonarr: status = await sonarr.system.get_status() print("✅ Sonarr Async Connection Successful!") print(f"Version: {status.get('version')}") series = await sonarr.series.get() print(f"Total Series in Library: {len(series)}") if series: print(f"Sample Series: {series[0]['title']}") except Exception as e: print(f"❌ Sonarr Async Connection Failed: {e}") try: async with AsyncRadarr( host=RADARR_HOST, api_key=RADARR_API_KEY, port=RADARR_PORT, tls=RADARR_TLS, request_timeout=REQUEST_TIMEOUT ) as radarr: status = await radarr.system.get_status() print("✅ Radarr Async Connection Successful!") print(f"Version: {status.get('version')}") movies = await radarr.movie.get() print(f"Total Movies in Library: {len(movies)}") if movies: print(f"Sample Movie: {movies[0]['title']}") except Exception as e: print(f"❌ Radarr Async Connection Failed: {e}") ``` -------------------------------- ### Manage Download Queue Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates pagination for queue retrieval and methods for removing items individually or in bulk. ```python queue = sonarr.queue.get(page=1, page_size=20, sort_key="timeleft", sort_dir="ascending") # Remove item sonarr.queue.delete(item_id=123, remove_from_client=True, blocklist=False) # Bulk remove sonarr.queue.bulk_delete(item_ids=[123, 124, 125], remove_from_client=True, blocklist=True) ``` -------------------------------- ### Execute Custom Async API Requests Source: https://github.com/totaldebug/pyarr/blob/main/test_async_live_environments.ipynb Shows how to use the http_utils.request method to perform direct API calls to specific endpoints, such as retrieving system health data. ```python async with AsyncSonarr( host=SONARR_HOST, api_key=SONARR_API_KEY, port=SONARR_PORT, tls=SONARR_TLS, request_timeout=REQUEST_TIMEOUT ) as sonarr: health = await sonarr.http_utils.request("health") print(json.dumps(health, indent=2)) ``` -------------------------------- ### Manage Artists in Lidarr Source: https://context7.com/totaldebug/pyarr/llms.txt Covers listing, looking up, adding, and deleting music artists in a Lidarr library. ```python from pyarr import Lidarr lidarr = Lidarr("192.168.1.100", "api-key", port=8686) # Get all artists artists = lidarr.artist.get() for artist in artists: print(f"{artist['artistName']} - Albums: {artist['statistics']['albumCount']}") # Lookup and add artist results = lidarr.artist.lookup(term="Radiohead") artist_to_add = results[0] added = lidarr.artist.add( artist=artist_to_add, root_dir="/music", quality_profile_id=1, metadata_profile_id=1, monitored=True, artist_monitor="all", search_for_missing_albums=True ) # Delete artist lidarr.artist.delete(item_id=1) ``` -------------------------------- ### Configure PyArr Connection Settings Source: https://github.com/totaldebug/pyarr/blob/main/test_async_live_environments.ipynb Defines the necessary configuration variables including host, port, API key, and TLS settings required to connect to Sonarr and Radarr instances. ```python import json from pyarr import AsyncRadarr, AsyncSonarr # --- Connection Details --- # Update these with your actual details SONARR_HOST = "localhost" SONARR_PORT = 8989 SONARR_API_KEY = "YOUR_SONARR_API_KEY" SONARR_TLS = False RADARR_HOST = "localhost" RADARR_PORT = 7878 RADARR_API_KEY = "YOUR_RADARR_API_KEY" RADARR_TLS = False # Optional: Increase timeout if you have a slow connection (default is None, which waits forever like requests) REQUEST_TIMEOUT = 60 ``` -------------------------------- ### Manage Tags Source: https://context7.com/totaldebug/pyarr/llms.txt Retrieves a list of all defined tags used for organizing media within the application. ```python tags = sonarr.tag.get() for tag in tags: print(f"ID: {tag['id']}, Label: {tag['label']}") ``` -------------------------------- ### Execute Custom API Requests with PyArr Source: https://github.com/totaldebug/pyarr/blob/main/test_sync_live_environments.ipynb Demonstrates how to use the http_utils.request method to call arbitrary API endpoints directly. This is useful for accessing endpoints not explicitly covered by the library's helper methods. ```python with Sonarr(host=SONARR_HOST, api_key=SONARR_API_KEY, port=SONARR_PORT, tls=SONARR_TLS) as sonarr: health = sonarr.http_utils.request("health") print(json.dumps(health, indent=2)) ``` -------------------------------- ### Verify Radarr Connection and Retrieve Library Data Source: https://github.com/totaldebug/pyarr/blob/main/test_sync_live_environments.ipynb Establishes a connection to a Radarr instance to check system status and count the number of movies in the library. It includes error handling to catch and report connection failures. ```python try: with Radarr(host=RADARR_HOST, api_key=RADARR_API_KEY, port=RADARR_PORT, tls=RADARR_TLS) as radarr: status = radarr.system.get_status() print("✅ Radarr Connection Successful!") print(f"Version: {status.get('version')}") movies = radarr.movie.get() print(f"Total Movies in Library: {len(movies)}") if movies: print(f"Sample Movie: {movies[0]['title']}") except Exception as e: print(f"❌ Radarr Connection Failed: {e}") ``` -------------------------------- ### Configure PyArr Connection Credentials Source: https://github.com/totaldebug/pyarr/blob/main/test_sync_live_environments.ipynb Defines the necessary configuration variables for connecting to Sonarr and Radarr instances. Users must update these constants with their specific host, port, and API key details. ```python import json from pyarr import Radarr, Sonarr SONARR_HOST = "localhost" SONARR_PORT = 8989 SONARR_API_KEY = "YOUR_SONARR_API_KEY" SONARR_TLS = False RADARR_HOST = "localhost" RADARR_PORT = 7878 RADARR_API_KEY = "YOUR_RADARR_API_KEY" RADARR_TLS = False ``` -------------------------------- ### Verify Sonarr Connection and Retrieve Library Data Source: https://github.com/totaldebug/pyarr/blob/main/test_sync_live_environments.ipynb Establishes a connection to a Sonarr instance to check system status and count the number of series in the library. It includes error handling to catch and report connection failures. ```python try: with Sonarr(host=SONARR_HOST, api_key=SONARR_API_KEY, port=SONARR_PORT, tls=SONARR_TLS) as sonarr: status = sonarr.system.get_status() print("✅ Sonarr Connection Successful!") print(f"Version: {status.get('version')}") series = sonarr.series.get() print(f"Total Series in Library: {len(series)}") if series: print(f"Sample Series: {series[0]['title']}") except Exception as e: print(f"❌ Sonarr Connection Failed: {e}") ``` -------------------------------- ### Manage Notifications with Sonarr API Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to retrieve notification configurations from Sonarr using the pyarr library. This includes fetching all configured notifications and their details, as well as retrieving notification schemas which define the available types and their configuration options. Requires a Sonarr instance. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get all notifications notifications = sonarr.notification.get() for notif in notifications: print(f"{notif['name']} - {notif['implementation']}") # Get notification schemas schemas = sonarr.notification.get_schema() ``` -------------------------------- ### Perform Prowlarr Searches (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to search for content across all configured indexers or specific indexers using the Prowlarr API. It includes retrieving search results with details like title, indexer, and size. ```python from pyarr import Prowlarr prowlarr = Prowlarr("192.168.1.100", "api-key", port=9696) # Search all indexers results = prowlarr.search.get(query="ubuntu 22.04") for result in results: print(f"{result['title']} - {result['indexer']} - {result['size']}") # Search specific indexers results = prowlarr.search.get( query="debian", indexer_ids=[1, 2, 3] # Only search these indexers ) ``` -------------------------------- ### Add Movie to Radarr Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates how to add a movie to a Radarr instance by specifying root directory, quality profiles, and monitoring status. ```python added_movie = radarr.movie.add( movie=movie_to_add, root_dir="/movies", quality_profile_id=quality_id, monitored=True, search_for_movie=True, minimum_availability="released", tags=[1, 2] ) print(f"Added: {added_movie['title']} ({added_movie['year']})") ``` -------------------------------- ### Manage Indexers with Sonarr API Source: https://context7.com/totaldebug/pyarr/llms.txt Demonstrates the management of indexers within Sonarr using the pyarr library. This includes fetching all configured indexers, retrieving their schemas to understand available types, updating an indexer's settings, and deleting an indexer. Assumes a Sonarr instance is running and accessible. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get all indexers indexers = sonarr.indexer.get() for indexer in indexers: print(f"{indexer['name']} - Enabled: {indexer['enable']}") # Get indexer schemas (available indexer types) schemas = sonarr.indexer.get_schema() for schema in schemas: print(f"Implementation: {schema['implementation']}") # Get schema for specific implementation torznab_schemas = sonarr.indexer.get_schema(implementation="Torznab") # Update an indexer indexer = sonarr.indexer.get(item_id=1) indexer['enable'] = True updated = sonarr.indexer.update(item_id=1, data=indexer) # Delete an indexer sonarr.indexer.delete(item_id=1) ``` -------------------------------- ### Monitor System Status and Health Source: https://context7.com/totaldebug/pyarr/llms.txt Retrieves system status, health issues, disk space, and scheduled tasks from an *arr application. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get system status status = sonarr.system.get_status() # Get health issues health = sonarr.system.get_health() # Get disk space disks = sonarr.system.get_diskspace() # System operations sonarr.system.request_restart() ``` -------------------------------- ### Query Media Calendar Source: https://context7.com/totaldebug/pyarr/llms.txt Retrieves upcoming media releases within a specific date range using Python datetime objects. ```python from datetime import datetime, timedelta start = datetime.now() end = start + timedelta(days=7) upcoming = sonarr.calendar.get(start_date=start, end_date=end, unmonitored=False) ``` -------------------------------- ### Retrieve Media History Source: https://context7.com/totaldebug/pyarr/llms.txt Fetches download and import history records with support for sorting and pagination. ```python history = radarr.history.get(page=1, page_size=50, sort_key="date", sort_dir="descending") for record in history['records']: print(f"{record['date']} - {record['eventType']} - {record['sourceTitle']}") ``` -------------------------------- ### Manage Sonarr Episodes Source: https://context7.com/totaldebug/pyarr/llms.txt Retrieve episode lists, fetch specific episode details, and perform bulk updates on monitoring status for series episodes. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get all episodes for a series episodes = sonarr.episode.get(series_id=1) # Update episode monitoring episode = sonarr.episode.get(item_id=100) episode['monitored'] = True sonarr.episode.update(item_id=100, data=episode) # Bulk update monitoring status sonarr.episode.monitor(episode_ids=[100, 101, 102], monitored=True) ``` -------------------------------- ### Manage Blocklist with Radarr (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt Shows how to retrieve the blocklist, delete a single entry from the blocklist, and perform a bulk deletion of multiple entries using the Radarr API. ```python from pyarr import Radarr radarr = Radarr("192.168.1.100", "api-key", port=7878) # Get blocklist blocklist = radarr.blocklist.get() print(f"Blocked items: {len(blocklist)}") # Delete single blocklist entry radarr.blocklist.delete(item_id=1) # Bulk delete blocklist entries radarr.blocklist.bulk_delete(item_ids=[1, 2, 3]) ``` -------------------------------- ### Common Components API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md General configuration, system operations, and media management endpoints available across most services. ```APIDOC ## Common Components API Endpoints ### Description Endpoints for general configuration, system operations, and media management that are common across various services. ### Method GET, PUT, POST ### Endpoint - `/api/v3/config/host` - `/api/v3/config/naming` - `/api/v3/config/ui` - `/api/v3/system/backup/restore` - `/api/v3/system/routes` - `/api/v3/parse` - `/api/v3/rename` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "POST /api/v3/system/backup/restore with backup file" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/v3/system/routes returns a list of available routes" } ``` ``` -------------------------------- ### Configure and Add Discord Notification (Python) Source: https://context7.com/totaldebug/pyarr/llms.txt This snippet shows how to retrieve Discord schema, configure webhook URL and notification settings, and then add it to Sonarr. It also demonstrates deleting the notification. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get Discord schema discord_schemas = sonarr.notification.get_schema(implementation="Discord") discord = discord_schemas[0] # Configure Discord webhook for field in discord['fields']: if field['name'] == 'webHookUrl': field['value'] = 'https://discord.com/api/webhooks/...' discord['name'] = 'Discord Alerts' discord['onGrab'] = True discord['onDownload'] = True discord['onUpgrade'] = True # Add notification new_notif = sonarr.notification.add(data=discord) # Delete notification sonarr.notification.delete(item_id=new_notif['id']) ``` -------------------------------- ### Manage Sonarr Series Source: https://context7.com/totaldebug/pyarr/llms.txt Retrieve, search, add, update, and delete TV series within Sonarr. These operations allow for granular control over media library organization and monitoring status. ```python from pyarr import Sonarr sonarr = Sonarr("192.168.1.100", "api-key", port=8989) # Get all series all_series = sonarr.series.get() # Get specific series by Sonarr ID series = sonarr.series.get(item_id=1) # Lookup series results = sonarr.series.lookup(term="Breaking Bad") # Add a series added_series = sonarr.series.add( series=results[0], quality_profile_id=1, language_profile_id=1, root_dir="/tv", season_folder=True, monitored=True, search_for_missing_episodes=True ) # Update and Delete series['monitored'] = False sonarr.series.update(data=series) sonarr.series.delete(item_id=1, delete_files=False) ``` -------------------------------- ### Manage and Delete Movies in Radarr Source: https://context7.com/totaldebug/pyarr/llms.txt Shows how to retrieve, update movie metadata, and perform single or bulk deletions of movies from a Radarr collection. ```python from pyarr import Radarr radarr = Radarr("192.168.1.100", "api-key", port=7878) # Update a movie movie = radarr.movie.get(item_id=1) movie['monitored'] = True movie['minimumAvailability'] = 'released' updated = radarr.movie.update(data=movie, move_files=False) print(f"Updated: {updated['title']}") # Delete a single movie radarr.movie.delete(item_id=1, delete_files=True, add_exclusion=True) # Bulk delete multiple movies radarr.movie.delete( item_id=[1, 2, 3], delete_files=False, add_exclusion=True ) ``` -------------------------------- ### Bazarr Specific API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md Endpoints for managing TV series, movies, episodes, and subtitle operations in Bazarr. ```APIDOC ## Bazarr Specific API Endpoints ### Description Endpoints for managing TV series, movies, episodes, and subtitle operations within Bazarr. ### Method GET, POST, PUT, DELETE ### Endpoint - `/api/series` - `/api/movies` - `/api/episodes` - `/api/subtitles/wanted` - `/api/subtitles/search` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "POST /api/subtitles/search to find missing subtitles" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/subtitles/wanted lists media missing subtitles" } ``` ``` -------------------------------- ### Manage Radarr Movies Source: https://context7.com/totaldebug/pyarr/llms.txt Retrieve, search, and add movies to a Radarr collection. Supports lookup by name, IMDB ID, or TMDB ID. ```python from pyarr import Radarr radarr = Radarr("192.168.1.100", "api-key", port=7878) # Get movies movies = radarr.movie.get() # Lookup movies results = radarr.movie.lookup(term="Inception") # Add a movie profiles = radarr.quality_profile.get() quality_id = profiles[0]['id'] # Note: Use radarr.movie.add() with appropriate parameters to finalize addition ``` -------------------------------- ### Dispatcharr Specific API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md Endpoints for exporting XMLTV and M3U data, and managing DVR/Series recording rules in Dispatcharr. ```APIDOC ## Dispatcharr Specific API Endpoints ### Description Endpoints for exporting EPG (XMLTV) and M3U playlist data, and for managing DVR/Series recording rules within Dispatcharr. ### Method GET, POST, PUT, DELETE ### Endpoint - `/epg` - `/m3u` - `/api/v1/series-rules` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "GET /epg to export XMLTV data" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/v1/series-rules returns a list of series recording rules" } ``` ``` -------------------------------- ### Prowlarr Specific API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md Endpoints for managing indexer configurations, testing, and sync profiles in Prowlarr. ```APIDOC ## Prowlarr Specific API Endpoints ### Description Endpoints for testing indexer configurations, retrieving indexer statistics and status, and managing application sync profiles in Prowlarr. ### Method GET, POST, PUT, DELETE ### Endpoint - `/api/v1/indexer/test` - `/api/v1/indexer/testall` - `/api/v1/indexerstats` - `/api/v1/indexerstatus` - `/api/v1/appprofile` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "POST /api/v1/indexer/test with indexer configuration" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/v1/indexerstats returns indexer performance statistics" } ``` ``` -------------------------------- ### Lidarr Specific API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md Endpoints for managing artists, albums, and metadata profiles in Lidarr. ```APIDOC ## Lidarr Specific API Endpoints ### Description Endpoints for managing artists, albums, retagging operations, and metadata profiles within Lidarr. ### Method GET, POST, PUT, DELETE ### Endpoint - `/api/v1/artist/editor` - `/api/v1/album/editor` - `/api/v1/retag` - `/api/v1/metadataprofile` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "PUT /api/v1/artist/editor for bulk artist updates" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/v1/retag lists files needing retagging" } ``` ``` -------------------------------- ### Radarr Specific API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md Endpoints for managing movies, custom formats, and collections in Radarr. ```APIDOC ## Radarr Specific API Endpoints ### Description Endpoints for managing movies, custom formats, and collections within Radarr. ### Method GET, POST, PUT, DELETE ### Endpoint - `/api/v3/movie/editor` - `/api/v3/movie/import` - `/api/v3/customformat` - `/api/v3/customformat/schema` - `/api/v3/collection` - `/api/v3/collection/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the collection to retrieve. #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "POST /api/v3/customformat to create a new custom format" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/v3/collection returns a list of movie collections" } ``` ``` -------------------------------- ### Sonarr Specific API Endpoints Source: https://github.com/totaldebug/pyarr/blob/main/docs/MISSING_ENDPOINTS.md Endpoints for managing series, episodes, and wanted lists in Sonarr. ```APIDOC ## Sonarr Specific API Endpoints ### Description Endpoints for managing series, episodes, wanted lists, and profiles within Sonarr. ### Method GET, POST, PUT, DELETE ### Endpoint - `/api/v3/series/editor` - `/api/v3/series/import` - `/api/v3/episode/monitor` - `/api/v3/episode/search` - `/api/v3/wanted/cutoff` - `/api/v3/languageprofile` - `/api/v3/delayprofile` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Varies by endpoint, refer to specific service documentation) ### Request Example ```json { "example": "PUT /api/v3/series/editor for bulk series updates" } ``` ### Response #### Success Response (200) (Varies by endpoint, refer to specific service documentation) #### Response Example ```json { "example": "GET /api/v3/wanted/cutoff returns episodes with unmet quality cutoffs" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.