Log if opening secure websocket

This commit is contained in:
JonnyWong16 2016-02-20 20:50:20 -08:00
parent f9f478e100
commit ca29333cd0

View file

@ -39,11 +39,13 @@ def run():
if plexpy.CONFIG.PMS_SSL and plexpy.CONFIG.PMS_URL[:5] == 'https': if plexpy.CONFIG.PMS_SSL and plexpy.CONFIG.PMS_URL[:5] == 'https':
uri = plexpy.CONFIG.PMS_URL.replace('https://', 'wss://') + '/:/websockets/notifications' uri = plexpy.CONFIG.PMS_URL.replace('https://', 'wss://') + '/:/websockets/notifications'
secure = ' secure'
else: else:
uri = 'ws://%s:%s/:/websockets/notifications' % ( uri = 'ws://%s:%s/:/websockets/notifications' % (
plexpy.CONFIG.PMS_IP, plexpy.CONFIG.PMS_IP,
plexpy.CONFIG.PMS_PORT plexpy.CONFIG.PMS_PORT
) )
secure = ''
# Set authentication token (if one is available) # Set authentication token (if one is available)
if plexpy.CONFIG.PMS_TOKEN: if plexpy.CONFIG.PMS_TOKEN:
@ -55,7 +57,7 @@ def run():
# Try an open the websocket connection - if it fails after 15 retries fallback to polling # Try an open the websocket connection - if it fails after 15 retries fallback to polling
while not ws_connected and reconnects <= 15: while not ws_connected and reconnects <= 15:
try: try:
logger.info(u'PlexPy WebSocket :: Opening websocket, connection attempt %s.' % str(reconnects + 1)) logger.info(u'PlexPy WebSocket :: Opening%s websocket, connection attempt %s.' % (secure, str(reconnects + 1)))
ws = create_connection(uri) ws = create_connection(uri)
reconnects = 0 reconnects = 0
ws_connected = True ws_connected = True