Create plex_allow_sync.py
This commit is contained in:
parent
522d9a6e7d
commit
05af0efecb
22
utility/plex_allow_sync.py
Normal file
22
utility/plex_allow_sync.py
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user