Skip to content

spyspirit0/arr-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

arr-scripts

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.

Table of Contents

Overview

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.

Prerequisites

  • Python 3.6 or higher
  • requests library (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

Monitoring Management

Scripts for automating the monitoring status of media in your library.


Radarr/radarr_unmonitor.py

Application: Radarr (Movies)

Purpose: Unmonitors all movies that have already been downloaded in your Radarr library.

How it works:

  1. Prompts you for Radarr URL and API key
  2. Connects to Radarr and retrieves all movies from your library
  3. Filters for movies that have files (already downloaded)
  4. Unmonitors each downloaded movie that is currently being monitored
  5. 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 ===

Sonarr/sonarr_unmonitor_episodes.py

Application: Sonarr (TV Series)

Purpose: Unmonitors all episodes that have already been downloaded in your Sonarr library.

How it works:

  1. Prompts you for Sonarr URL and API key
  2. Connects to Sonarr and retrieves all series
  3. For each series, gets all episodes
  4. Filters for episodes with files (already downloaded)
  5. Unmonitors each downloaded episode that is currently being monitored
  6. 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

Sonarr/sonarr_unmonitor_complete_seasons.py

Application: Sonarr (TV Series)

Purpose: Unmonitors entire seasons when all episodes in that season have been downloaded.

How it works:

  1. Prompts you for Sonarr URL and API key
  2. Connects to Sonarr and retrieves all series with their episodes
  3. Groups episodes by season
  4. Checks if all episodes in each season have files
  5. For complete seasons, unmonitors all episodes in that season at once
  6. 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 ===

Sonarr/sonarr_unmonitor_finished_series.py

Application: Sonarr (TV Series)

Purpose: Unmonitors TV series that have ended/finished airing.

How it works:

  1. Prompts you for Sonarr URL and API key
  2. Connects to Sonarr and retrieves all series
  3. Checks each series' status (continuing, ended, cancelled, etc.)
  4. For series marked as "ended", unmonitors the entire series
  5. 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 ===

Installation

Clone the Repository

git clone https://github.com/lefebp/arr-scripts.git
cd arr-scripts

Install Dependencies

pip install requests

Make Scripts Executable (Linux/Mac)

chmod +x Radarr/*.py Sonarr/*.py

Usage

All scripts follow the same interactive pattern:

Step 1: Run the Script

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.py

Step 2: Provide Connection Details

When 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

Step 3: Review Output

The script will:

  • Connect to your *arr application
  • Show what it's processing
  • Display progress for each item
  • Provide a final summary

Finding Your API Key

*All arr Applications:

  1. Open your *arr application web interface
  2. Go to Settings → General
  3. Scroll to Security section
  4. Copy the API Key

Default Ports:

  • Radarr: 7878
  • Sonarr: 8989
  • Lidarr: 8686
  • Readarr: 8787
  • Prowlarr: 9696

Running from Anywhere

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

Automating Scripts (Optional)

While these scripts are designed for manual/on-demand use, you can automate them if you modify them to remove the interactive prompts.

Option 1: Using *arr Application Custom Scripts

If you adapt the scripts to use hardcoded configuration or environment variables instead of prompts, you can integrate them directly into your *arr applications:

  1. 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"
  2. *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

Option 2: Scheduled Tasks (Cron/Task Scheduler)

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.py

Using 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() lines

Note: Remember to keep your API keys secure when using automated methods. Don't commit config files with API keys to version control!

Troubleshooting

Connection Errors

Error: Could not connect to Radarr/Sonarr

Solutions:

  • Verify the URL is correct and includes http:// or https://
  • 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

API Key Errors

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

No Items Found

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

Permission Errors

Error: Permission denied

Solutions:

  • Make sure the script is executable: chmod +x script.py
  • Run with python3 script.py instead of ./script.py
  • Check file permissions in the directory

Import Errors

Error: ModuleNotFoundError: No module named 'requests'

Solution:

pip install requests
# or
pip3 install requests

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. When contributing:

  1. Test your changes thoroughly
  2. Update documentation as needed
  3. Follow the existing code style (interactive prompts for config)
  4. Describe your changes in the PR
  5. Indicate which *arr application(s) the script supports

Script Template

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...

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

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.

Acknowledgments

  • 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

Support

If you encounter issues:

  1. Check the Troubleshooting section
  2. Review your *arr application logs for errors
  3. Verify your connection details (URL and API key)
  4. 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

About

Scripts for arr apps

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages