Ejemplo n.º 1
0
 def _setDelayedRefresh(self):
     refreshInterval = Settings.getRefreshInterval()
     # Set the refresh delay to about 3-4 seconds
     if refreshInterval < 1000:
         self.delayedRefresh = 7
     elif refreshInterval < 2000:
         self.delayedRefresh = 4
     elif refreshInterval < 4000:
         self.delayedRefresh = 2
     else:
         self.delayedRefresh = 1
Ejemplo n.º 2
0
                # Subscribe to receive notifications of changes
                sub = sonosDevice.avTransport.subscribe()

                # Make sure that we stop the screensaver coming in, the minimum value
                # for the screensaver is 1 minute - so set at 40 seconds to keep active
                stopScreensaver = 40000

                while (not sonosCtrl.isClose()) and (not xbmc.abortRequested):
                    # Now get the details of an event if there is one there
                    lastChangeDetails = sonosDevice.getLastEventDetails(sub)

                    # Update the displayed information
                    sonosCtrl.updateDisplay(eventDetails=lastChangeDetails)

                    # Wait a second or so before updating
                    xbmc.sleep(Settings.getRefreshInterval())

                    stopScreensaver = stopScreensaver - Settings.getRefreshInterval(
                    )
                    if stopScreensaver < 0:
                        # A bit of a hack, but we need Kodi to think a user is "doing things" so
                        # that it does not start the screensaver, so we just send the message
                        # to open the Context menu - which in our case will do nothing
                        # but it does make Kodi think the user has done something
                        json_query = xbmc.executeJSONRPC(
                            '{"jsonrpc": "2.0", "method": "Input.ContextMenu", "id": 1}'
                        )
                        stopScreensaver = 40000

            except:
                # Failed to connect to the Sonos Speaker