Skip to content

Instantly share code, notes, and snippets.

@jmarhee
Last active May 29, 2024 22:54
Show Gist options
  • Save jmarhee/c2d2d9bff9ba545ba214b6a4fd70da5d to your computer and use it in GitHub Desktop.
Save jmarhee/c2d2d9bff9ba545ba214b6a4fd70da5d to your computer and use it in GitHub Desktop.
from plexapi.myplex import MyPlexAccount
import os
plex_auth_info = {
"username" : os.environ['PLEX_USERNAME'],
"password" : os.environ['PLEX_PASSWORD'],
"server" : os.environ['PLEX_SERVER_NAME']
}
account = MyPlexAccount(plex_auth_info['username'], plex_auth_info['password'])
plex = account.resource(plex_auth_info['server']).connect()
collections = plex.library.section("Movies").collections()
for idx, val in enumerate(collections):
if plex.library.section("Movies").collection(title=collections[idx].title).childCount != 0:
continue
else:
plex.library.section("Movies").collection(title=collections[idx].title).delete()
@TheOne320
Copy link

How do I use the script with 2FA on? Could you set it up to use "X-Plex-Token"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment