added support for admin account
This commit is contained in:
parent
59add7f167
commit
90738fc076
@ -68,12 +68,17 @@ plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess)
|
|||||||
|
|
||||||
sections_lst = [x.title for x in plex.library.sections()]
|
sections_lst = [x.title for x in plex.library.sections()]
|
||||||
user_lst = [x.title for x in plex.myPlexAccount().users()]
|
user_lst = [x.title for x in plex.myPlexAccount().users()]
|
||||||
|
# Adding admin account name to list
|
||||||
|
user_lst.append(plex.myPlexAccount().title)
|
||||||
|
|
||||||
def get_account(user):
|
def get_account(user):
|
||||||
# Access Plex User's Account
|
if user == plex.myPlexAccount().title:
|
||||||
userAccount = plex.myPlexAccount().user(user)
|
server = plex
|
||||||
token = userAccount.get_token(plex.machineIdentifier)
|
else:
|
||||||
server = PlexServer(PLEX_URL, token)
|
# Access Plex User's Account
|
||||||
|
userAccount = plex.myPlexAccount().user(user)
|
||||||
|
token = userAccount.get_token(plex.machineIdentifier)
|
||||||
|
server = PlexServer(PLEX_URL, token)
|
||||||
return server
|
return server
|
||||||
|
|
||||||
|
|
||||||
@ -143,4 +148,4 @@ if __name__ == '__main__':
|
|||||||
print('Syncing watch status of {} to {}\'s account.'.format(title, user))
|
print('Syncing watch status of {} to {}\'s account.'.format(title, user))
|
||||||
item.markWatched()
|
item.markWatched()
|
||||||
else:
|
else:
|
||||||
print('No libraries or rating key provided.')
|
print('No libraries or rating key provided.')
|
||||||
|
Loading…
Reference in New Issue
Block a user