Skip to content

Instantly share code, notes, and snippets.

@Hellowlol
Last active January 18, 2019 19:03
Show Gist options
  • Save Hellowlol/3fa001f0763ae8035af90ce4b548f3ad to your computer and use it in GitHub Desktop.
Save Hellowlol/3fa001f0763ae8035af90ce4b548f3ad to your computer and use it in GitHub Desktop.
top250
from plexapi.server import PlexServer
from imdbpie import Imdb
baseurl = 'http://10.0.0.97:32400'
token = ''
plex = PlexServer(baseurl, token)
imdb = Imdb()
top = imdb.top_250()
movies = plex.library.all(type='movie')
to_playlist = []
# Get top250 in your library
lib_two_fifty = sorted([i for i in movies if i.rating], key=lambda k: k.rating, reverse=True)[:250]
missing = []
for movie in top:
for item in lib_two_fifty:
if movie.get('tconst') in item.guid:
#item.addCollection('top250')
to_playlist.append(item)
print('Adding %s %s' % (item.title, item.year))
else:
missing.append(movie)
print('Your missing %s from top250 imbd' % len(missing))
for miss in missing:
print('Missing %s %s' % (miss.get('title'), miss.get('year')))
playlist = plex.createPlaylist("imdb250", to_playlist)
for user in plex.myPlexAccount.users():
playlist.copyToUser(user)
print('Done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment