mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-13 16:52:58 -07:00
Reconnect Plex Cloud without keeping the server awake
This commit is contained in:
parent
df016243dd
commit
e1dca1509a
6 changed files with 77 additions and 28 deletions
|
@ -144,14 +144,7 @@ class PlexTV(object):
|
|||
uri = '/users/sign_in.xml'
|
||||
base64string = base64.b64encode(('%s:%s' % (self.username, self.password)).encode('utf-8'))
|
||||
headers = {'Content-Type': 'application/xml; charset=utf-8',
|
||||
'X-Plex-Device-Name': 'Tautulli',
|
||||
'X-Plex-Product': 'Tautulli',
|
||||
'X-Plex-Version': plexpy.common.VERSION_NUMBER,
|
||||
'X-Plex-Platform': plexpy.common.PLATFORM,
|
||||
'X-Plex-Platform-Version': plexpy.common.PLATFORM_VERSION,
|
||||
'X-Plex-Client-Identifier': plexpy.CONFIG.PMS_UUID,
|
||||
'Authorization': 'Basic %s' % base64string
|
||||
}
|
||||
'Authorization': 'Basic %s' % base64string}
|
||||
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
request_type='POST',
|
||||
|
@ -318,6 +311,14 @@ class PlexTV(object):
|
|||
|
||||
return request
|
||||
|
||||
def cloud_server_status(self, output_format=''):
|
||||
uri = '/api/v2/cloud_server'
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
request_type='GET',
|
||||
output_format=output_format)
|
||||
|
||||
return request
|
||||
|
||||
def get_full_users_list(self):
|
||||
friends_list = self.get_plextv_friends(output_format='xml')
|
||||
own_account = self.get_plextv_user_details(output_format='xml')
|
||||
|
@ -753,3 +754,21 @@ class PlexTV(object):
|
|||
devices_list.append(device)
|
||||
|
||||
return devices_list
|
||||
|
||||
def get_cloud_server_status(self):
|
||||
cloud_status = self.cloud_server_status(output_format='xml')
|
||||
|
||||
try:
|
||||
status_info = cloud_status.getElementsByTagName('info')
|
||||
except Exception as e:
|
||||
logger.warn(u"Tautulli PlexTV :: Unable to parse XML for get_cloud_server_status: %s." % e)
|
||||
return False
|
||||
|
||||
for info in status_info:
|
||||
servers = info.getElementsByTagName('server')
|
||||
for s in servers:
|
||||
if helpers.get_xml_attr(s, 'address') == plexpy.CONFIG.PMS_IP:
|
||||
if helpers.get_xml_attr(info, 'running') == '1':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue