Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
771 B
51
Indexable
Never
from plexapi.server import PlexServer

# Replace PLEX_URL, PLEX_TOKEN, and LIBRARY_NAME with the appropriate values for your Plex server
PLEX_URL = 'http://localhost:32400'
PLEX_TOKEN = 'xxxxxx'
LIBRARY_NAME = 'Movies'

# Connect to the Plex server
plex = plexapi.PlexServer(PLEX_URL, PLEX_TOKEN)

# Get the movie library
library = plex.library.section(LIBRARY_NAME)

# Iterate through all movies in the library
for movie in library.all():
  # Get the resolution and HDR type of the movie
  video_resolution = movie.videoResolution
  hdr_type = movie.videoHDR
  
  # Create a shortened version of the resolution and HDR type
  edition = f'{video_resolution} {hdr_type}'
  
  # Update the movie's "Editions" field with the shortened version
  movie.edit(editions=edition)