### Docker Compose Configuration Source: https://github.com/nickshanks347/monitarr/blob/main/README.md Example configuration for deploying Monitarr using Docker Compose. ```yaml services: monitarr: container_name: monitarr image: ghcr.io/nickshanks347/monitarr:latest ports: - 3000:3000 environment: - SONARR_URL=http://sonarr:8989 - SONARR_API_KEY=YOUR_SONARR_API_KEY - RADARR_URL=http://radarr:7878 - RADARR_API_KEY=YOUR_RADARR_API_KEY - BASE_PATH=/monitarr # Optional: for subfolder hosting restart: unless-stopped ``` -------------------------------- ### Manage Monitarr Container Lifecycle Source: https://context7.com/nickshanks347/monitarr/llms.txt Commands for starting, stopping, and viewing logs for the Monitarr container. ```bash # Start the container docker compose up -d # View logs docker logs -f monitarr # Stop the container docker compose down ``` -------------------------------- ### GET /api/sonarr/downloads - Get Sonarr Download Queue Source: https://context7.com/nickshanks347/monitarr/llms.txt Retrieves the current download queue from Sonarr, displaying active TV show downloads with their progress and details. ```APIDOC ## GET /api/sonarr/downloads ### Description Retrieves the current download queue from Sonarr (TV shows). Returns an array of downloads with progress, size, speed, and time remaining information, sorted by progress percentage (highest first). ### Method GET ### Endpoint /api/sonarr/downloads ### Response #### Success Response (200) - **Array of DownloadType objects**: Each object contains details about an active download. - **id** (number) - Unique identifier from Sonarr. - **title** (string) - Display title of the TV show episode. - **progress** (number) - Download progress percentage (0-100). - **size** (string) - Total file size (e.g., "1.2 GB"). - **speed** (string) - Current download speed (e.g., "5.50 MB/s"). - **timeRemaining** (string) - Estimated time remaining (e.g., "00:05:30"). #### Empty Queue Response (200) An empty array `[]` if there are no active downloads. ### Response Example ```json [ { "id": 123, "title": "Breaking Bad - S01E01", "progress": 75, "size": "1.2 GB", "speed": "5.50 MB/s", "timeRemaining": "00:05:30" }, { "id": 124, "title": "The Office - S02E05", "progress": 45, "size": "0.8 GB", "speed": "3.25 MB/s", "timeRemaining": "00:08:15" } ] ``` ``` -------------------------------- ### GET /api/radarr/downloads - Get Radarr Download Queue Source: https://context7.com/nickshanks347/monitarr/llms.txt Retrieves the current download queue from Radarr, displaying active movie downloads with their progress and details. ```APIDOC ## GET /api/radarr/downloads ### Description Retrieves the current download queue from Radarr (movies). Returns an array of downloads with progress, size, speed, and time remaining information, sorted by progress percentage (highest first). ### Method GET ### Endpoint /api/radarr/downloads ### Response #### Success Response (200) - **Array of DownloadType objects**: Each object contains details about an active download. - **id** (number) - Unique identifier from Radarr. - **title** (string) - Display title of the movie. - **progress** (number) - Download progress percentage (0-100). - **size** (string) - Total file size (e.g., "4.5 GB"). - **speed** (string) - Current download speed (e.g., "10.25 MB/s"). - **timeRemaining** (string) - Estimated time remaining (e.g., "00:03:45"). #### Empty Queue Response (200) An empty array `[]` if there are no active downloads. ### Response Example ```json [ { "id": 456, "title": "Inception", "progress": 90, "size": "4.5 GB", "speed": "10.25 MB/s", "timeRemaining": "00:03:45" }, { "id": 457, "title": "The Dark Knight", "progress": 30, "size": "5.2 GB", "speed": "8.00 MB/s", "timeRemaining": "00:15:20" } ] ``` ``` -------------------------------- ### GET /api/ping - Health Check Source: https://context7.com/nickshanks347/monitarr/llms.txt A simple health check endpoint to verify if the Monitarr server is running. ```APIDOC ## GET /api/ping ### Description Simple health check endpoint that returns a ping response to verify the server is running. ### Method GET ### Endpoint /api/ping ### Response #### Success Response (200) - **message** (string) - Indicates the server is responsive, typically with a value of "pong". ### Response Example ```json { "message": "pong" } ``` ``` -------------------------------- ### Configure Environment Variables Source: https://context7.com/nickshanks347/monitarr/llms.txt Define the necessary API credentials and service URLs in a .env file to connect Monitarr to Sonarr and Radarr. ```bash # .env configuration SONARR_URL=http://localhost:8989 SONARR_API_KEY=your-sonarr-api-key RADARR_URL=http://localhost:7878 RADARR_API_KEY=your-radarr-api-key BASE_PATH= # Optional: for subfolder hosting (e.g., /monitarr) ``` -------------------------------- ### Environment Configuration Source: https://github.com/nickshanks347/monitarr/blob/main/README.md Required environment variables for connecting to Sonarr and Radarr instances. ```text SONARR_URL=http://localhost:8989 SONARR_API_KEY=your-sonarr-api-key RADARR_URL=http://localhost:7878 RADARR_API_KEY=your-radarr-api-key BASE_PATH= ``` -------------------------------- ### Fetch and Refresh Downloads via API Source: https://context7.com/nickshanks347/monitarr/llms.txt Utility functions for retrieving download lists and triggering queue refreshes from the frontend. ```typescript // Fetch downloads from either service const fetchDownloads = async (endpoint: string): Promise => { const response = await fetch(endpoint) if (!response.ok) { throw new Error('Failed to fetch data') } return response.json() } // Trigger a queue refresh const triggerQueueRefresh = async (endpoint: string) => { const response = await fetch(endpoint, { method: 'POST' }) if (!response.ok) { throw new Error('Failed to trigger queue refresh') } } // Example: Fetch Sonarr downloads const sonarrDownloads = await fetchDownloads('/api/sonarr/downloads') // Example: Refresh both queues await triggerQueueRefresh('/api/sonarr/downloads/refresh') await triggerQueueRefresh('/api/radarr/downloads/refresh') ``` -------------------------------- ### Retrieve Radarr Download Queue Source: https://context7.com/nickshanks347/monitarr/llms.txt Fetch the current active download queue from Radarr. ```bash # Fetch all active Radarr downloads curl http://localhost:3000/api/radarr/downloads # Response - Array of DownloadType objects [ { "id": 456, "title": "Inception", "progress": 90, "size": "4.5 GB", "speed": "10.25 MB/s", "timeRemaining": "00:03:45" }, { "id": 457, "title": "The Dark Knight", "progress": 30, "size": "5.2 GB", "speed": "8.00 MB/s", "timeRemaining": "00:15:20" } ] ``` -------------------------------- ### Retrieve Sonarr Download Queue Source: https://context7.com/nickshanks347/monitarr/llms.txt Fetch the current active download queue from Sonarr. ```bash # Fetch all active Sonarr downloads curl http://localhost:3000/api/sonarr/downloads # Response - Array of DownloadType objects [ { "id": 123, "title": "Breaking Bad - S01E01", "progress": 75, "size": "1.2 GB", "speed": "5.50 MB/s", "timeRemaining": "00:05:30" }, { "id": 124, "title": "The Office - S02E05", "progress": 45, "size": "0.8 GB", "speed": "3.25 MB/s", "timeRemaining": "00:08:15" } ] # Empty queue response [] ``` -------------------------------- ### Sort Download Data Source: https://context7.com/nickshanks347/monitarr/llms.txt Logic for sorting download arrays based on title, size, time remaining, or progress. ```typescript // Sort downloads by various criteria const sortDownloads = (downloads: DownloadType[]) => { return [...downloads].sort((a, b) => { let comparison = 0 if (sortCriteria === 'title') { comparison = a.title.localeCompare(b.title) } else if (sortCriteria === 'size') { comparison = parseFloat(a.size) - parseFloat(b.size) } else if (sortCriteria === 'timeRemaining') { comparison = parseFloat(a.timeRemaining) - parseFloat(b.timeRemaining) } else if (sortCriteria === 'progress') { comparison = a.progress - b.progress } return isSortAscending ? comparison : -comparison }) } // Usage const sortedSonarrDownloads = sortDownloads(sonarrDownloads) ``` -------------------------------- ### Refresh Download Queues Source: https://context7.com/nickshanks347/monitarr/llms.txt Trigger a refresh command for Sonarr or Radarr queues. ```bash # Trigger Sonarr queue refresh curl -X POST http://localhost:3000/api/sonarr/downloads/refresh # Response - Sonarr command status { "id": 12345, "name": "RefreshMonitoredDownloads", "commandName": "Refresh Monitored Downloads", "status": "started", "queued": "2024-01-15T10:30:00Z", "started": "2024-01-15T10:30:01Z" } ``` ```bash # Trigger Radarr queue refresh curl -X POST http://localhost:3000/api/radarr/downloads/refresh # Response - Radarr command status { "id": 67890, "name": "RefreshMonitoredDownloads", "commandName": "Refresh Monitored Downloads", "status": "started", "queued": "2024-01-15T10:30:00Z", "started": "2024-01-15T10:30:01Z" } ``` -------------------------------- ### POST /api/sonarr/downloads/refresh - Refresh Sonarr Queue Source: https://context7.com/nickshanks347/monitarr/llms.txt Triggers a refresh of the monitored downloads queue in Sonarr to update download status. ```APIDOC ## POST /api/sonarr/downloads/refresh ### Description Triggers a refresh of the monitored downloads queue in Sonarr. This sends a `RefreshMonitoredDownloads` command to Sonarr's API and returns the command status. ### Method POST ### Endpoint /api/sonarr/downloads/refresh ### Response #### Success Response (200) - **commandStatus** (object) - Details about the executed command. - **id** (number) - The unique ID of the command. - **name** (string) - The name of the command executed (e.g., "RefreshMonitoredDownloads"). - **commandName** (string) - A human-readable name for the command. - **status** (string) - The current status of the command (e.g., "started"). - **queued** (string) - The timestamp when the command was queued. - **started** (string) - The timestamp when the command started execution. ### Response Example ```json { "id": 12345, "name": "RefreshMonitoredDownloads", "commandName": "Refresh Monitored Downloads", "status": "started", "queued": "2024-01-15T10:30:00Z", "started": "2024-01-15T10:30:01Z" } ``` ``` -------------------------------- ### POST /api/radarr/downloads/refresh - Refresh Radarr Queue Source: https://context7.com/nickshanks347/monitarr/llms.txt Triggers a refresh of the monitored downloads queue in Radarr to update download status. ```APIDOC ## POST /api/radarr/downloads/refresh ### Description Triggers a refresh of the monitored downloads queue in Radarr. This sends a `RefreshMonitoredDownloads` command to Radarr's API and returns the command status. ### Method POST ### Endpoint /api/radarr/downloads/refresh ### Response #### Success Response (200) - **commandStatus** (object) - Details about the executed command. - **id** (number) - The unique ID of the command. - **name** (string) - The name of the command executed (e.g., "RefreshMonitoredDownloads"). - **commandName** (string) - A human-readable name for the command. - **status** (string) - The current status of the command (e.g., "started"). - **queued** (string) - The timestamp when the command was queued. - **started** (string) - The timestamp when the command started execution. ### Response Example ```json { "id": 67890, "name": "RefreshMonitoredDownloads", "commandName": "Refresh Monitored Downloads", "status": "started", "queued": "2024-01-15T10:30:00Z", "started": "2024-01-15T10:30:01Z" } ``` ``` -------------------------------- ### Health Check API Source: https://context7.com/nickshanks347/monitarr/llms.txt Verify the server status using the ping endpoint. ```bash # Check if the server is running curl http://localhost:3000/api/ping # Response { "message": "pong" } ``` -------------------------------- ### Implement Auto-Refresh Logic Source: https://context7.com/nickshanks347/monitarr/llms.txt Use React hooks to poll the API at configurable intervals. ```typescript // Set up auto-refresh with configurable interval const [autoRefreshInterval, setAutoRefreshInterval] = useState(null) useEffect(() => { if (autoRefreshInterval) { const intervalId = setInterval(() => { // Refresh both Sonarr and Radarr triggerQueueRefresh('/api/sonarr/downloads/refresh').catch(console.error) fetchDownloads('/api/sonarr/downloads').then(setSonarrDownloads).catch(console.error) triggerQueueRefresh('/api/radarr/downloads/refresh').catch(console.error) fetchDownloads('/api/radarr/downloads').then(setRadarrDownloads).catch(console.error) }, autoRefreshInterval * 1000) return () => clearInterval(intervalId) } }, [autoRefreshInterval]) // Available intervals: 5, 15, 30, 60, 300 seconds handleAutoRefreshChange('15') // Refresh every 15 seconds ``` -------------------------------- ### DownloadType TypeScript Definition Source: https://context7.com/nickshanks347/monitarr/llms.txt The standardized interface for download items returned by the API. ```typescript // types/Download.ts export type DownloadType = { id: number // Unique identifier from Sonarr/Radarr title: string // Display title (e.g., "Show Name - S01E01" or "Movie Name") progress: number // Download progress percentage (0-100) size: string // Total file size (e.g., "1.2 GB") speed: string // Current download speed (e.g., "5.50 MB/s") timeRemaining: string // Estimated time remaining (e.g., "00:05:30") } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.