Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- # Radarr configuration
- RADARR_API_URL = "YOUR_RADARR_URL/api/v3/command"
- RADARR_API_KEY = "YOUR_RADARR_API_KEY"
- # Path to the downloads folder inside Radarr's container
- DOWNLOADS_FOLDER = "/downloads"
- def force_import():
- """
- Triggers Radarr to scan the downloads folder and import completed items.
- """
- payload = {
- "name": "DownloadedMoviesScan",
- "path": DOWNLOADS_FOLDER
- }
- headers = {
- "X-Api-Key": RADARR_API_KEY
- }
- try:
- response = requests.post(RADARR_API_URL, json=payload, headers=headers, verify=False)
- if response.status_code == 201:
- print("Successfully triggered import process for completed downloads.")
- else:
- print(f"Failed to trigger import. Status code: {response.status_code}")
- print(f"Response: {response.text}")
- except Exception as e:
- print(f"An error occurred: {e}")
- if __name__ == "__main__":
- force_import()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement