diff --git a/utility/sync_watch_status.py b/utility/sync_watch_status.py index 9f8316d..8e37b1f 100644 --- a/utility/sync_watch_status.py +++ b/utility/sync_watch_status.py @@ -68,12 +68,17 @@ plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess) sections_lst = [x.title for x in plex.library.sections()] 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): - # Access Plex User's Account - userAccount = plex.myPlexAccount().user(user) - token = userAccount.get_token(plex.machineIdentifier) - server = PlexServer(PLEX_URL, token) + if user == plex.myPlexAccount().title: + server = plex + else: + # Access Plex User's Account + userAccount = plex.myPlexAccount().user(user) + token = userAccount.get_token(plex.machineIdentifier) + server = PlexServer(PLEX_URL, token) return server @@ -143,4 +148,4 @@ if __name__ == '__main__': print('Syncing watch status of {} to {}\'s account.'.format(title, user)) item.markWatched() else: - print('No libraries or rating key provided.') \ No newline at end of file + print('No libraries or rating key provided.')