Ejemplo n.º 1
0
 def check(self):
     if Settings.autoPauseSonos() and not Settings.linkAudioWithSonos():
         try:
             # Check to see if something has started playing
             if xbmc.Player().isPlaying():
                 # If this is a change in play state since the last time we checked
                 if self.xbmcPlayState is False:
                     log("SonosAutoPause: Automatically pausing Sonos")
                     self.xbmcPlayState = True
                     # Pause the sonos if it is playing
                     if self._isSonosPlaying():
                         self.sonosDevice.pause()
                         self.autoStopped = True
                         self.resumeCountdown = Settings.autoResumeSonos()
             else:
                 self.xbmcPlayState = False
                 if Settings.autoResumeSonos() > 0 and self.autoStopped:
                     if self.resumeCountdown > 0:
                         self.resumeCountdown = self.resumeCountdown - 1
                     else:
                         log("SonosAutoPause: Automatically resuming Sonos")
                         self.sonosDevice.play()
                         self.autoStopped = False
                         self.resumeCountdown = Settings.autoResumeSonos()
         except:
             # If we fail to stop the speaker playing, it may be because
             # there is a network problem or the speaker is powered down
             # So we just continue after logging the error
             log("SonosAutoPause: Error from speaker %s" %
                 Settings.getIPAddress())
             log("SonosAutoPause: %s" % traceback.format_exc())
Ejemplo n.º 2
0
 def check(self):
     if Settings.autoPauseSonos() and not Settings.linkAudioWithSonos():
         try:
             # Check to see if something has started playing
             if xbmc.Player().isPlaying():
                 # If this is a change in play state since the last time we checked
                 if self.xbmcPlayState is False:
                     log("SonosAutoPause: Automatically pausing Sonos")
                     self.xbmcPlayState = True
                     # Pause the sonos if it is playing
                     if self._isSonosPlaying():
                         self.sonosDevice.pause()
                         self.autoStopped = True
                         self.resumeCountdown = Settings.autoResumeSonos()
             else:
                 self.xbmcPlayState = False
                 if Settings.autoResumeSonos() > 0 and self.autoStopped:
                     if self.resumeCountdown > 0:
                         self.resumeCountdown = self.resumeCountdown - 1
                     else:
                         log("SonosAutoPause: Automatically resuming Sonos")
                         self.sonosDevice.play()
                         self.autoStopped = False
                         self.resumeCountdown = Settings.autoResumeSonos()
         except:
             # If we fail to stop the speaker playing, it may be because
             # there is a network problem or the speaker is powered down
             # So we just continue after logging the error
             log("SonosAutoPause: Error from speaker %s" % Settings.getIPAddress())
             log("SonosAutoPause: %s" % traceback.format_exc())
Ejemplo n.º 3
0
 def __init__(self, sonosDevice):
     self.sonosDevice = sonosDevice
     self.xbmcPlayState = False
     self.autoStopped = False
     self.resumeCountdown = Settings.autoResumeSonos()
Ejemplo n.º 4
0
 def __init__(self, sonosDevice):
     self.sonosDevice = sonosDevice
     self.xbmcPlayState = False
     self.autoStopped = False
     self.resumeCountdown = Settings.autoResumeSonos()