From 90738fc0767b359cb87631e1188b409ce28b577a Mon Sep 17 00:00:00 2001
From: Blacktwin <asimmons28501@gmail.com>
Date: Thu, 12 Apr 2018 15:39:19 -0400
Subject: [PATCH] added support for admin account

---
 utility/sync_watch_status.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

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.')