These scripts compare the target instance against the source and remove items from the target that:
- Do not exist in the source, or
- Exist in the source but are not in allowed quality profiles (optional)
Designed for mirrored libraries, read-only replicas, or downstream servers.
- Works for both Sonarr and Radarr.
- Safe dry-run/debug mode to preview changes before applying.
- Optional delete files mode to remove media from disk.
- Uses TVDB IDs (Sonarr) and TMDB IDs (Radarr) for accurate matching.
- Confirmation prompt before deleting (can be disabled).
- Designed for consistency between Sonarr and Radarr scripts.
- Python 3.9+
requestslibrary (pip install requests)- Sonarr v3 or Radarr v3 API access
Both scripts have configuration flags at the top of the file for easy setup:
DEBUG_MODE = True # True = show differences only, NO changes
DELETE_FILES = True # True = delete media files on disk
REQUIRE_CONFIRMATION = True # Ask before deleting (ignored in DEBUG_MODE)
# Example for Sonarr
SONARR_1_URL = "https://sonarr.source.url"
SONARR_1_API_KEY = "API_KEY_HERE"
SONARR_2_URL = "http://sonarr.target.url"
SONARR_2_API_KEY = "API_KEY_HERE"
# Example for Radarr
RADARR_1_URL = "https://radarr.source.url"
RADARR_1_API_KEY = "API_KEY_HERE"
RADARR_2_URL = "http://radarr.target.url"
RADARR_2_API_KEY = "API_KEY_HERE"ENFORCE_SOURCE_PROFILES = True
ALLOWED_PROFILE_NAMES = [
"HD - 720p/1080p + 4K"
]If enabled:
- Items not in the allowed profiles in the source will be removed from the target.
| Flag | Description |
|---|---|
DEBUG_MODE |
True = Preview differences, do not delete anything |
DELETE_FILES |
True = Remove media files from disk |
REQUIRE_CONFIRMATION |
True = Prompt before deletion (ignored in DEBUG_MODE) |
- Dry-run only:
DEBUG_MODE = True
DELETE_FILES = False- Remove from target only (no files deleted):
DEBUG_MODE = False
DELETE_FILES = False- Full cleanup (delete from target + files):
DEBUG_MODE = False
DELETE_FILES = TrueYou can also disable the confirmation prompt by setting
REQUIRE_CONFIRMATION = False.
- Scripts use TVDB ID (Sonarr) and TMDB ID (Radarr) to avoid accidental deletion based on title mismatches.
- Always run in DEBUG_MODE first to verify the list of items that will be deleted.
- Backup your Sonarr/Radarr database before performing destructive runs.
- Works best with Sonarr/Radarr v3 APIs.