Last active
January 14, 2025 20:02
-
-
Save JonnyWong16/c1534909228b0d662cddbe3e894487a6 to your computer and use it in GitHub Desktop.
Refresh metadata for an item in Plex
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 argparse | |
import os | |
from plexapi.server import PlexServer | |
PLEX_URL = os.getenv('PLEX_URL') | |
PLEX_TOKEN = os.getenv('PLEX_TOKEN') | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--rating_key', required=True, type=int) | |
opts = parser.parse_args() | |
plex = PlexServer(PLEX_URL, PLEX_TOKEN) | |
item = plex.fetchItem(opts.rating_key) | |
print(f"Refreshing metadata for media: {item.title}") | |
item.refresh() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment