diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 76cf8365..c2cdd294 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -1063,6 +1063,11 @@ msgctxt "#39071" msgid "Current plex.tv status:" msgstr "" +# PKC Settings - Connection +msgctxt "#39072" +msgid "Background sync connection:" +msgstr "" + # PKC Settings, category name msgctxt "#39073" msgid "Appearance Tweaks" @@ -1124,6 +1129,26 @@ msgctxt "#39085" msgid "Reload Kodi node files to apply all the settings below" msgstr "" +# PKC Settings - Connection - Background sync connection status +msgctxt "#39089" +msgid "Alexa connection status:" +msgstr "" + +# PKC Settings - Connection - Background sync connection status +msgctxt "#39090" +msgid "Suspended - not connected" +msgstr "" + +# PKC Settings - Connection - Background sync connection status +msgctxt "#39091" +msgid "Timeout - not connected" +msgstr "" + +# PKC Settings - Connection - Background sync connection status +msgctxt "#39092" +msgid "IOError - not connected" +msgstr "" + msgctxt "#39200" msgid "Log-out Plex Home User " msgstr "" diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index 62002db5..17b2b513 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -14,6 +14,7 @@ LOG = getLogger('PLEX.websocket_client') class WebSocket(backgroundthread.KillableThread): opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY) + status_setting = None def __init__(self): self.ws = None @@ -76,6 +77,8 @@ class WebSocket(backgroundthread.KillableThread): if self.should_suspend(): # Set in service.py self.close_websocket() + # Status = 'Suspended - not connected' + utils.settings(self.status_setting, value=utils.lang(39090)) if self.wait_while_suspended(): # Abort was requested while waiting. We should exit return @@ -99,10 +102,16 @@ class WebSocket(backgroundthread.KillableThread): # Server is probably offline LOG.debug("%s: IOError connecting", self.__class__.__name__) self.ws = None + # Status = IOError - not connected + utils.settings(self.status_setting, + value=utils.lang(39092)) self._sleep_cycle() except websocket.WebSocketTimeoutException: LOG.debug("%s: WebSocketTimeoutException", self.__class__.__name__) self.ws = None + # Status = 'Timeout - not connected' + utils.settings(self.status_setting, + value=utils.lang(39091)) self._sleep_cycle() except websocket.WebsocketRedirect as e: LOG.debug('301 redirect detected: %s', e) @@ -115,6 +124,9 @@ class WebSocket(backgroundthread.KillableThread): except websocket.WebSocketException as e: LOG.debug('%s: WebSocketException: %s', self.__class__.__name__, e) self.ws = None + # Status = Error + utils.settings(self.status_setting, + value=utils.lang(257)) self._sleep_cycle() except Exception as e: LOG.error('%s: Unknown exception encountered when ' @@ -123,9 +135,15 @@ class WebSocket(backgroundthread.KillableThread): LOG.error("%s: Traceback:\n%s", self.__class__.__name__, traceback.format_exc()) self.ws = None + # Status = Error + utils.settings(self.status_setting, + value=utils.lang(257)) self._sleep_cycle() else: self.sleeptime = 0.0 + # Status = Connected + utils.settings(self.status_setting, + value=utils.lang(13296)) except Exception as e: LOG.error("%s: Unknown exception encountered: %s", self.__class__.__name__, e) @@ -133,12 +151,16 @@ class WebSocket(backgroundthread.KillableThread): LOG.error("%s: Traceback:\n%s", self.__class__.__name__, traceback.format_exc()) self.close_websocket() + # Status = Error + utils.settings(self.status_setting, value=utils.lang(257)) class PMS_Websocket(WebSocket): """ Websocket connection with the PMS for Plex Companion """ + status_setting = 'pms_websocket_status' + def should_suspend(self): """ Returns True if the thread is suspended. @@ -205,6 +227,8 @@ class Alexa_Websocket(WebSocket): """ Websocket connection to talk to Amazon Alexa. """ + status_setting = 'alexa_websocket_status' + def should_suspend(self): """ Overwrite method since we need to check for plex token diff --git a/resources/settings.xml b/resources/settings.xml index b046ce12..fda93768 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -1,12 +1,15 @@ - - - + + + + + + @@ -36,6 +39,7 @@ +