def turnStereoOff(): global needsStereoPowerOn, usingStereo usingStereo = False if default_output_device_is_airplay() or not mayUseStereo(): return if not needsStereoPowerOn and HAVE_XTENSION and XTensionApp().status('Stereo'): XTensionApp().turnoff('Stereo') needsStereoPowerOn = True
def turnStereoOnOrOff(): global needsStereoPowerOn, usingStereo usingStereo = False if not default_output_device_is_airplay() and not mayUseStereo(): if HAVE_XTENSION and XTensionApp().status('Stereo'): XTensionApp().turnoff('Stereo') return if HAVE_XTENSION and not XTensionApp().status('Stereo'): XTensionApp().turnon('Stereo') usingStereo = True needsStereoPowerOn = False
def screensDidSleep(self, notification): # if we're AirPlaying audio, we probably can hear it and will notice if default_output_device_is_airplay(): return # pause everything (prevents continued playback if you walk away without pausing explicitly) iTunes = iTunesApp() if iTunes.player_state() == k.playing: iTunes.pause() for player in HermesApp(), SpotifyApp(): if player.isrunning(): player.pause()