Last active
December 5, 2025 21:32
-
-
Save Ravencentric/38002d8e056fd6c226d4460fb82f251a to your computer and use it in GitHub Desktop.
Script to refresh monitored downloads in Sonarr/Radarr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Script to trigger the RefreshMonitoredDownloads task in Sonarr and Radarr | |
| # Sonarr/Radarr only checks the monitored downloads every 60 seconds which | |
| # means that your download could be done in 20 seconds but it'll sit there | |
| # for an additional 40 seconds before Sonarr/Radarr check again. This script | |
| # will run when a download finishes and trigger the RefreshMonitoredDownloads | |
| # task. | |
| import os | |
| import requests | |
| def RefreshMonitoredDownloads(API_KEY: str, URL: str) -> None: | |
| PAYLOAD = {"name": "RefreshMonitoredDownloads"} | |
| headers = { | |
| "Content-Type": "application/json", | |
| "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36", | |
| "X-Api-Key": API_KEY, | |
| "X-Requested-With": "XMLHttpRequest", | |
| } | |
| requests.post(URL, headers=headers, json=PAYLOAD) | |
| SONARR_API_KEY = "abc123" | |
| SONARR_URL = "http://127.0.0.1:8989/api/v3/command" | |
| RADARR_API_KEY = "abc123" | |
| RADARR_URL = "http://127.0.0.1:7878/api/v3/command" | |
| RefreshMonitoredDownloads(SONARR_API_KEY, SONARR_URL) | |
| RefreshMonitoredDownloads(RADARR_API_KEY, RADARR_URL) |
Great @Warbs816! Yea what you posted is something I had in mind.
Maybe worth checking if you have some old version of SAB or some switch flipped in the settings that marks a download only complete after a the script finishes running?
But obviously if SAB waits for the script to finish it will also wait for the sleep call to finish hence rendering it useless. Triggering a second script might be the only way for you then.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @dodofarm - sleeping in the same script didn't work, SABnzbd again just waits for the entire script to finish before marking a job as complete.
I had tried a second trigger script, but initially the first script that SABnzbd runs was waiting for that to finish before also completing, but after some tweaks I got it to work!
Thanks again!
Trigger script: