A collection of automation scripts for the *arr application suite to streamline media library management.
Note: These scripts were created and reviewed with the help of LLM. They have been tested but use at your own risk.
This repository contains Python automation scripts for *arr applications (Sonarr, Radarr, Lidarr, Readarr, etc.). These are interactive, manual scripts that you run on-demand from your computer to perform bulk operations on your media library.
All scripts prompt you for connection details (URL and API key) when executed, so you can run them from any machine with network access to your *arr applications - no pre-configuration needed.
Current focus areas:
- Automatic monitoring status management
- Library organization and maintenance
- Bulk operations on downloaded media
As the repository grows, additional scripts for other purposes and arr applications will be added to expand functionality.
- Python 3.6 or higher
requestslibrary (pip install requests)- Active *arr application installations (Sonarr, Radarr, Lidarr, Readarr, etc.)
- API access to your *arr instances
- Network connectivity between your computer and your arr applications
Scripts for automating the monitoring status of media in your library.
Application: Radarr (Movies)
Purpose: Unmonitors all movies that have already been downloaded in your Radarr library.
How it works:
- Prompts you for Radarr URL and API key
- Connects to Radarr and retrieves all movies from your library
- Filters for movies that have files (already downloaded)
- Unmonitors each downloaded movie that is currently being monitored
- Displays progress and a summary of changes
Result: Downloaded movies will no longer be searched for upgrades or replacements, reducing indexer load and preventing unnecessary downloads.
When to use:
- You want to stop Radarr from searching for quality upgrades on movies you already have
- You're satisfied with your current downloads and want to reduce indexer API calls
- You want to clean up your monitoring status for better library management
Example output:
Enter Radarr URL (e.g., http://10.1.0.100:7878): http://localhost:7878
Enter API Key (Get from Settings → General → Security): abc123...
Connecting to Radarr...
Found 150 downloaded movies
✓ Unmonitored: Night of the Living Dead (1968)
✓ Unmonitored: Metropolis (1927)
...
=== Done! Unmonitored 150 movies ===
Application: Sonarr (TV Series)
Purpose: Unmonitors all episodes that have already been downloaded in your Sonarr library.
How it works:
- Prompts you for Sonarr URL and API key
- Connects to Sonarr and retrieves all series
- For each series, gets all episodes
- Filters for episodes with files (already downloaded)
- Unmonitors each downloaded episode that is currently being monitored
- Displays progress and a summary of changes
Result: Downloaded episodes will no longer be searched for upgrades or replacements while keeping future episodes monitored.
When to use:
- You want to stop upgrade searches for episodes you already have
- You're satisfied with current episode quality but want to continue monitoring new releases
- You want to reduce unnecessary background activity in Sonarr
Application: Sonarr (TV Series)
Purpose: Unmonitors entire seasons when all episodes in that season have been downloaded.
How it works:
- Prompts you for Sonarr URL and API key
- Connects to Sonarr and retrieves all series with their episodes
- Groups episodes by season
- Checks if all episodes in each season have files
- For complete seasons, unmonitors all episodes in that season at once
- Displays progress and a summary of complete seasons unmonitored
Result: Entire completed seasons are unmonitored while incomplete seasons and future seasons remain monitored.
When to use:
- You want to unmonitor seasons you've fully downloaded
- You prefer season-level management over individual episode management
- You want to keep monitoring active for incomplete or upcoming seasons
Example output:
Enter Sonarr URL (e.g., http://10.1.0.100:8989): http://localhost:8989
Enter API Key (Get from Settings → General → Security): xyz789...
Connecting to Sonarr...
Processing: Vintage Comedy Show
✓ Unmonitored Season 1 (10/10 episodes complete)
✓ Unmonitored Season 2 (10/10 episodes complete)
⊘ Skipped Season 3 (7/10 episodes - incomplete)
...
=== Done! Unmonitored 12 complete seasons ===
Application: Sonarr (TV Series)
Purpose: Unmonitors TV series that have ended/finished airing.
How it works:
- Prompts you for Sonarr URL and API key
- Connects to Sonarr and retrieves all series
- Checks each series' status (continuing, ended, cancelled, etc.)
- For series marked as "ended", unmonitors the entire series
- Displays which series were unmonitored and which are still ongoing
Result: Completed/cancelled series are fully unmonitored, freeing up resources for currently airing shows.
When to use:
- You want to clean up monitoring for shows that won't produce new episodes
- You want to focus Sonarr's monitoring on currently airing shows
- You want to reduce unnecessary background tasks and API calls
Example output:
Enter Sonarr URL (e.g., http://10.1.0.100:8989): http://localhost:8989
Enter API Key (Get from Settings → General → Security): xyz789...
Connecting to Sonarr...
✓ Unmonitored: Vintage Comedy Show (Ended)
✓ Unmonitored: Old Show (Ended)
→ Still monitoring: Newest Show (Continuing)
...
=== Done! Unmonitored 18 finished series ===
git clone https://github.com/lefebp/arr-scripts.git
cd arr-scriptspip install requestschmod +x Radarr/*.py Sonarr/*.pyAll scripts follow the same interactive pattern:
python3 Radarr/radarr_unmonitor.py
# or
python3 Sonarr/sonarr_unmonitor_episodes.py
# or
python3 Sonarr/sonarr_unmonitor_complete_seasons.py
# or
python3 Sonarr/sonarr_unmonitor_finished_series.pyWhen prompted, enter:
- URL: Your *arr application URL (e.g.,
http://192.168.1.100:7878) - API Key: Found in your *arr app under Settings → General → Security
The script will:
- Connect to your *arr application
- Show what it's processing
- Display progress for each item
- Provide a final summary
*All arr Applications:
- Open your *arr application web interface
- Go to Settings → General
- Scroll to Security section
- Copy the API Key
Default Ports:
- Radarr: 7878
- Sonarr: 8989
- Lidarr: 8686
- Readarr: 8787
- Prowlarr: 9696
Since these scripts prompt for connection details, you can:
- Run them from your desktop computer
- Run them from a remote server
- Run them from any machine with network access to your *arr apps
- Use them with multiple *arr instances by entering different URLs each time
While these scripts are designed for manual/on-demand use, you can automate them if you modify them to remove the interactive prompts.
If you adapt the scripts to use hardcoded configuration or environment variables instead of prompts, you can integrate them directly into your *arr applications:
-
Modify the script to remove
input()prompts and use hardcoded values:# Replace this: RADARR_URL = input("Enter Radarr URL...").strip() API_KEY = input("Enter API Key...").strip() # With this: RADARR_URL = "http://localhost:7878" API_KEY = "your_api_key_here"
-
*Add to your arr app:
- Go to Settings → Connect → Add → Custom Script
- Set triggers based on your needs:
- On Import: Run when new media is imported
- On Upgrade: Run when media is upgraded
- On Download: Run when download completes
- Or whatever your needs are.
- Path: Point to your modified script
- Test the connection
For scripts that operate on your entire library (like sonarr_unmonitor_finished_series.py), scheduled tasks work better:
Using environment variables:
# Set environment variables
export RADARR_URL="http://localhost:7878"
export RADARR_API_KEY="your_api_key_here"
# Linux cron example (runs daily at 3 AM)
0 3 * * * cd /path/to/arr-scripts && python3 Radarr/radarr_unmonitor.pyUsing a configuration file:
Create a config.py file:
RADARR_URL = "http://localhost:7878"
RADARR_API_KEY = "your_api_key_here"
SONARR_URL = "http://localhost:8989"
SONARR_API_KEY = "your_other_api_key"Then modify your scripts to import from it:
from config import RADARR_URL, API_KEY
# Remove the input() linesNote: Remember to keep your API keys secure when using automated methods. Don't commit config files with API keys to version control!
Error: Could not connect to Radarr/Sonarr
Solutions:
- Verify the URL is correct and includes
http://orhttps:// - Make sure the *arr application is running
- Check that the port number is correct
- Ensure your firewall allows connections
- Test the URL in your web browser first
Error: HTTP 401 or Check your API key
Solutions:
- Verify you copied the complete API key from Settings → General → Security
- Make sure there are no extra spaces in the API key
- Check that API key authentication is enabled in your *arr app
Message: Found 0 downloaded movies/episodes
This is normal if:
- You haven't downloaded any media yet
- All items are already unmonitored
- Your library is empty
Error: Permission denied
Solutions:
- Make sure the script is executable:
chmod +x script.py - Run with
python3 script.pyinstead of./script.py - Check file permissions in the directory
Error: ModuleNotFoundError: No module named 'requests'
Solution:
pip install requests
# or
pip3 install requestsContributions are welcome! Please feel free to submit a Pull Request. When contributing:
- Test your changes thoroughly
- Update documentation as needed
- Follow the existing code style (interactive prompts for config)
- Describe your changes in the PR
- Indicate which *arr application(s) the script supports
New scripts should follow this pattern:
import requests
# Prompt for configuration
ARR_URL = input("Enter [App] URL (e.g., http://10.1.0.100:PORT): ").strip()
API_KEY = input("Enter API Key (Get from Settings → General → Security): ").strip()
# Remove trailing slash
ARR_URL = ARR_URL.rstrip('/')
headers = {"X-Api-Key": API_KEY}
# Your script logic here...This project is licensed under the MIT License - see the LICENSE file for details.
These scripts modify your *arr applications. While they have been tested, they are provided as-is without warranty. Always backup your arr configurations before running bulk operations.
Important: These scripts make changes based on current library status. Review what each script does before running it on your production library.
- Scripts created and reviewed with assistance from LLM
- Thanks to the *arr community for their excellent applications and APIs
- Inspired by the need for better library management automation
If you encounter issues:
- Check the Troubleshooting section
- Review your *arr application logs for errors
- Verify your connection details (URL and API key)
- Open an issue on GitHub with:
- Script name
- *arr application and version
- Error messages
- Connection details (sanitized - don't share your API key!)
Repository: https://github.com/lefebp/arr-scripts