Skip to content

Instantly share code, notes, and snippets.

@wilpig
Created July 26, 2022 15:02
Show Gist options
  • Save wilpig/9d9600840e5481af3169b44da7bcccd6 to your computer and use it in GitHub Desktop.
Save wilpig/9d9600840e5481af3169b44da7bcccd6 to your computer and use it in GitHub Desktop.
#!/bin/python3
import re
import subprocess
import sys
try:
from plexapi.server import PlexServer
except ImportError or ModuleNotFoundError:
print ('python-plex module is missing run pip3 install plexapi')
sys.exit(1)
baseurl = 'http://plex.wilpig.org:32400'
token = '<TOKEN GOES HERE>'
plex = PlexServer(baseurl, token)
output = subprocess.check_output("find /Volumes/media2/movies.hd/ -type f -mmin -360 -exec basename {} \;", shell=True)
for title in output.decode().split('\n'):
title=re.match('(^.*)\ \([0-9]{4}\).*',title)
if title:
for x in plex.library.section('Movies').search(title[1]):
print (x.title)
x.analyze()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment