From 6e9f299c19077b29f9d8bf1bb912671809ef2efe Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 5 Mar 2019 21:55:13 -0800 Subject: [PATCH] Add secure/insecure icon to activity card --- .../default/current_activity_instance.html | 9 ++++++++- plexpy/pmsconnect.py | 15 +++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index 881853ce..9e95b68a 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -283,10 +283,17 @@ DOCUMENTATION :: END
  • Location
    + % if data['secure'] is not None: + % if data['secure']: + + % else: + + % endif + % endif ${data['location'].upper()}: % if data['ip_address'] != 'N/A': ${data['ip_address']} - % if data['relay']: + % if data['relayed']: % else: diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 7a76e87d..22db3bf6 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -1510,7 +1510,9 @@ class PmsConnect(object): 'player': helpers.get_xml_attr(player_info, 'title') or helpers.get_xml_attr(player_info, 'product'), 'machine_id': helpers.get_xml_attr(player_info, 'machineIdentifier'), 'state': helpers.get_xml_attr(player_info, 'state'), - 'local': helpers.get_xml_attr(player_info, 'local') + 'local': int(helpers.get_xml_attr(player_info, 'local') == '1'), + 'relayed': helpers.get_xml_attr(player_info, 'relayed', default_return=None), + 'secure': helpers.get_xml_attr(player_info, 'secure', default_return=None) } # Get the session details @@ -1524,12 +1526,17 @@ class PmsConnect(object): else: session_details = {'session_id': '', 'bandwidth': '', - 'location': 'wan' if player_details['local'] == '0' else 'lan' + 'location': 'lan' if player_details['local'] else 'wan' } # Check if using Plex Relay - session_details['relay'] = int(session_details['location'] != 'lan' - and player_details['ip_address_public'] == '127.0.0.1') + if player_details['relayed'] is None: + player_details['relayed'] = int(session_details['location'] != 'lan' and + player_details['ip_address_public'] == '127.0.0.1') + + # Check if secure connection + if player_details['secure'] is not None: + player_details['secure'] = int(player_details['secure'] == '1') # Get the transcode details if session.getElementsByTagName('TranscodeSession'):