Add removeHomeUser

Add ability to remove a Home User. If Home User is an Existing Plex User then User will go back into Sharing/Friends with sections and settings carrying over. Any Home User settings (LiveTV) are removed.
This commit is contained in:
blacktwin 2019-07-25 08:33:56 -04:00 committed by GitHub
parent a7df2a9ed8
commit 654f25b3f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -67,6 +67,7 @@ class MyPlexAccount(PlexObject):
FRIENDSERVERS = 'https://plex.tv/api/servers/{machineId}/shared_servers/{serverId}' # put with data
PLEXSERVERS = 'https://plex.tv/api/servers/{machineId}' # get
FRIENDUPDATE = 'https://plex.tv/api/friends/{userId}' # put with args, delete
REMOVEHOMEUSER = 'https://plex.tv/api/home/users/{userId}' # delete
REMOVEINVITE = 'https://plex.tv/api/invites/requested/{userId}?friend=0&server=1&home=0' # delete
REQUESTED = 'https://plex.tv/api/invites/requested' # get
REQUESTS = 'https://plex.tv/api/invites/requests' # get
@ -339,6 +340,16 @@ class MyPlexAccount(PlexObject):
url = url.format(userId=user.id)
return self.query(url, self._session.delete)
def removeHomeUser(self, user):
""" Remove the specified managed user from home.
Parameters:
user (str): MyPlexUser, username, email of the user to be removed from home.
"""
user = self.user(user)
url = self.REMOVEHOMEUSER.format(userId=user.id)
return self.query(url, self._session.delete)
def updateFriend(self, user, server, sections=None, removeSections=False, allowSync=None, allowCameraUpload=None,
allowChannels=None, filterMovies=None, filterTelevision=None, filterMusic=None):
""" Update the specified user's share settings.