A Python script that automatically toggles the monitored status of episodes in Sonarr based on a custom text list.
By default, this script is configured with a curated watch guide for Star Trek: The Next Generation (using the "Must Watch" episodes from letswatchstartrek.com's TNG Episode Guide), keeping the essential episodes monitored and unmonitoring the filler/skippable episodes. However, it can easily be customized for any TV show (e.g., The X-Files, anime fillers, Doctor Who).
- Smart Matching: Accounts for differences between your text list and TVDB/Sonarr naming schemes (e.g., matching
"Part II"with"(2)"). - Master Switch Override: Automatically ensures the Series and Season-level master switches are turned ON in Sonarr, otherwise individual episode changes won't be respected.
- Bulk Processing: Makes minimal API calls by sending bulk payloads to update hundreds of episodes in seconds.
- Python 3.x
- The
requestslibrary
- Clone or download this repository.
- Install the required Python dependencies:
pip install -r requirements.txt
- Open
sonarr_selective_monitor.pyin a text editor. - Locate the CONFIGURATION section at the top of the file:
SONARR_URL = "http://localhost:8989" API_KEY = "YOUR_API_KEY_HERE" SERIES_TITLE = "Star Trek: The Next Generation"
- Replace
YOUR_API_KEY_HEREwith your actual Sonarr API key (Found in Sonarr -> Settings -> General -> Security). Update the URL if your Sonarr is hosted elsewhere.
Run the script from your terminal:
python sonarr_selective_monitor.pyThe script will output a grid showing exactly which episodes were found, what they matched against, and what API actions were sent to Sonarr. (Note: You may need to refresh your Sonarr web page in your browser to see the UI update).
To use this for a different show:
- Change the
SERIES_TITLEvariable to the exact name of the show in Sonarr. - Replace the
EPISODE_LIST_TEXTvariable with your own list. Just ensure you group them by season using the wordSeason Xon its own line. Any episode listed under a season will be monitored; any episode not on the list will be unmonitored.
- The default Star Trek: TNG episode list is credited to the "Must Watch" guide at letswatchstartrek.com.