- Timestamp:
- 09/14/09 01:01:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StreamVision/StreamVision.py
r497 r580 95 95 needsStereoPowerOn = HAVE_XTENSION 96 96 97 def mayUseStereo(): 98 if not HAVE_XTENSION: 99 return False 100 systemEvents = app(id='com.apple.systemEvents') 101 return not systemEvents.application_processes[u'iTunes'].windows[1].buttons[its.title == u'Computer'].exists() 102 103 def turnStereoOn(): 104 global needsStereoPowerOn 105 if not mayUseStereo(): 106 return 107 if not XTensionApp().status('Stereo'): 108 XTensionApp().turnon('Stereo') 109 needsStereoPowerOn = False 110 111 def turnStereoOff(): 112 global needsStereoPowerOn 113 if not mayUseStereo(): 114 return 115 if not needsStereoPowerOn and XTensionApp().status('Stereo'): 116 XTensionApp().turnoff('Stereo') 117 needsStereoPowerOn = True 118 97 119 def amuaPlaying(): 98 120 if not HAVE_AMUA: … … 128 150 129 151 def displayTrackInfo(self, playerInfo=None): 130 global needsStereoPowerOn131 132 152 iTunes = iTunesApp() 133 153 … … 143 163 if iTunes.player_state() != k.playing: 144 164 growlNotify('iTunes is not playing.', trackName) 145 if HAVE_XTENSION: 146 if not needsStereoPowerOn and XTensionApp().status('Stereo'): 147 XTensionApp().turnoff('Stereo') 148 needsStereoPowerOn = True 149 return 150 if needsStereoPowerOn: 151 if not XTensionApp().status('Stereo'): 152 XTensionApp().turnon('Stereo') 153 needsStereoPowerOn = False 165 turnStereoOff() 166 return 167 turnStereoOn() 154 168 if trackClass == k.URL_track: 155 169 if amuaPlaying(): … … 246 260 iTunes.browser_windows[1].view.set(iTunes.user_playlists[its.name=='Stations'][1]()) 247 261 iTunes.play() 248 if HAVE_XTENSION and useStereo: 249 if iTunes.player_state() == k.playing: 250 XTensionApp().turnon('Stereo') 251 needsStereoPowerOn = False 252 else: 253 XTensionApp().turnoff('Stereo') 254 needsStereoPowerOn = True 262 if not useStereo: 263 return 264 if iTunes.player_state() == k.playing: 265 turnStereoOn() 266 else: 267 turnStereoOff() 255 268 256 269 def playPauseFront(self):
Note:
See TracChangeset
for help on using the changeset viewer.