Advertisement
yellowleader

Download Scan

Apr 25th, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.98 KB | Movies | 0 0
  1. import requests
  2.  
  3. # Radarr configuration
  4. RADARR_API_URL = "YOUR_RADARR_URL/api/v3/command"
  5. RADARR_API_KEY = "YOUR_RADARR_API_KEY"
  6.  
  7. # Path to the downloads folder inside Radarr's container
  8. DOWNLOADS_FOLDER = "/downloads"
  9.  
  10. def force_import():
  11.     """
  12.    Triggers Radarr to scan the downloads folder and import completed items.
  13.    """
  14.     payload = {
  15.         "name": "DownloadedMoviesScan",
  16.         "path": DOWNLOADS_FOLDER
  17.     }
  18.     headers = {
  19.         "X-Api-Key": RADARR_API_KEY
  20.     }
  21.  
  22.     try:
  23.         response = requests.post(RADARR_API_URL, json=payload, headers=headers, verify=False)
  24.         if response.status_code == 201:
  25.             print("Successfully triggered import process for completed downloads.")
  26.         else:
  27.             print(f"Failed to trigger import. Status code: {response.status_code}")
  28.             print(f"Response: {response.text}")
  29.     except Exception as e:
  30.         print(f"An error occurred: {e}")
  31.  
  32. if __name__ == "__main__":
  33.     force_import()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement