From 05af0efecb010971ffb89192cf90b3c1ae0f8287 Mon Sep 17 00:00:00 2001 From: blacktwin Date: Mon, 18 Sep 2017 15:27:31 -0400 Subject: [PATCH] Create plex_allow_sync.py --- utility/plex_allow_sync.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 utility/plex_allow_sync.py diff --git a/utility/plex_allow_sync.py b/utility/plex_allow_sync.py new file mode 100644 index 0000000..0e3a3dc --- /dev/null +++ b/utility/plex_allow_sync.py @@ -0,0 +1,22 @@ +""" +Allow syncing for users + +""" + +import requests +from plexapi.server import PlexServer + +PLEX_URL = 'http://localhost:32400' +PLEX_TOKEN = 'xxxx' +plex = PlexServer(PLEX_URL, PLEX_TOKEN) + +USER_IGNORE = ['username'] + +user_lst = [str(user.id) for user in plex.myPlexAccount().users() if user.title not in USER_IGNORE] + +payload = {'X-Plex-Token': PLEX_TOKEN, + 'allowSync': 0} + +for user_id in user_lst: + r = requests.put('http://plex.tv/api/friends/' + user_id, params=payload) + print(r.status_code)