Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Plex SD to Radarr for Quality Upgrade
# Scans your plex movies, if a movie has only SD quality, it will send it to Radarr
# pip install plexapi
# python 3.6+
from plexapi.server import PlexServer
import re
import requests
plex_url = ''
plex_token = 'abc123'
radarr_host = ''
radarr_port = 7878
radarr_api_key = 'abc123'
radarr_quality_profile = 6 # Use Chrome Developer tools to discover the ID. For me, this is my "1080/720p" profile
radarr_movie_path = '/movies/'
def radarr_search_movie(imdb_id: str):
url = f'http://{radarr_host}:{radarr_port}/api/movie/lookup/imdb?imdbId={imdb_id}&apikey={radarr_api_key}'
response = requests.get(url)
if response.status_code == 200:
return response.json()
return None
def radarr_add_movie(payload: dict):
return'http://{radarr_host}:{radarr_port}/api/movie?apikey={radarr_api_key}', json=payload)
def main():
plex = PlexServer(plex_url, plex_token)
movies = plex.library.section('Movies')
for movie in
if and len( == 1 and[0].videoResolution == 'sd':
imdb_id ='(tt[0-9]+)', movie.guid)[0]
except Exception:
print(f"Can't find IMDB ID for {movie.title}")
rs = radarr_search_movie(imdb_id)
if rs:
payload = {
'title': rs['title'],
'titleSlug': rs['titleSlug'],
'images': rs['images'],
'tmdbId': rs['tmdbId'],
'profileId': rs['profileId'],
'year': rs['year'],
'qualityProfileId': radarr_quality_profile,
'rootFolderPath': radarr_movie_path,
'monitored': True,
'addOptions': {
'searchForMovie': True
submit = radarr_add_movie(payload)
if submit.status_code == 201:
print(f'Movie added to Radarr: {movie.title}')
print(f'{movie.title}: {submit.json()[0]["errorMessage"]}.')
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.