Last active
April 24, 2025 18:53
-
-
Save jmarhee/c2d2d9bff9ba545ba214b6a4fd70da5d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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() |
Thanks, I had already modified the script based on another script that used X-Plex-Token. It works fine.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Getting a PlexServer Instance