Last active
September 9, 2023 08:54
-
-
Save JurajNyiri/7d2d333de6c5d76de61cf7860840c201 to your computer and use it in GitHub Desktop.
Radarr script which slowly goes through the all the imported movies and asks for a refresh for items missing files. Useful if Radarr is sometimes crashing on refreshes.
This file contains 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
import requests | |
import time | |
API_KEY = "change_me" | |
while True: | |
try: | |
response = requests.get("http://192.168.100.19:7878/api/v3/movie", headers={"X-Api-Key": API_KEY}) | |
missingFilesCount=0 | |
for movie in response.json(): | |
if movie['hasFile'] is False: | |
missingFilesCount+=1 | |
print(f"Missing: {missingFilesCount}") | |
time.sleep(10) | |
for movie in response.json(): | |
print(f"Processing {movie['title']}...") | |
if movie['hasFile'] is False: | |
try: | |
response = requests.post("http://192.168.100.19:7878/api/v3/command", headers={"X-Api-Key": API_KEY, "Content-Type": "application/json"}, json={"name":"RefreshMovie","movieIds":[movie['id']]}) | |
responseData = response.json() | |
print(responseData) | |
time.sleep(10) | |
except: | |
pass | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment