Merge pull request #189 from DirtyCajunRice/master

Add check for already-unshared libraries
This commit is contained in:
blacktwin 2019-10-02 15:45:27 -04:00 committed by GitHub
commit 4ac7313ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,5 +113,11 @@ for user in TAUTULLI_USERS:
if DRY_RUN:
print('{}, and would unshare libraries.'.format(OUTPUT))
else:
print('{}, and has reached their inactivity limit. Unsharing.'.format(OUTPUT))
ACCOUNT.updateFriend(PLEX_USERS[UID], SERVER, SECTIONS, removeSections=True)
for server in ACCOUNT.user(PLEX_USERS[UID]).servers:
if server.machineIdentifier == SERVER.machineIdentifier and server.sections():
print('{}, and has reached their inactivity limit. Unsharing.'.format(OUTPUT))
ACCOUNT.updateFriend(PLEX_USERS[UID], SERVER, SECTIONS, removeSections=True)
else:
print("{}, has already been unshared, but has not reached their shareless threshold."
"Skipping.".format(OUTPUT))