- Timestamp:
- 02/25/08 23:16:56 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StreamVision/StreamVision.py
r341 r414 75 75 def iTunesApp(): return app(id='com.apple.iTunes') 76 76 def XTensionApp(): return app(creator='SHEx') 77 def AmuaApp(): return app('Amua.app') 77 78 78 79 HAVE_XTENSION = False … … 83 84 pass 84 85 86 HAVE_AMUA = False 87 try: 88 AmuaApp() 89 HAVE_AMUA = True 90 except: 91 pass 92 85 93 needsStereoPowerOn = HAVE_XTENSION 94 95 def amuaPlaying(): 96 if not HAVE_AMUA: 97 return False 98 return AmuaApp().is_playing() 86 99 87 100 class StreamVision(NSApplication): … … 90 103 hotKeys = [] 91 104 92 def displayTrackInfo(self ):105 def displayTrackInfo(self, playerInfo=None): 93 106 global needsStereoPowerOn 94 107 … … 112 125 needsStereoPowerOn = False 113 126 if trackClass == k.URL_track: 127 if amuaPlaying(): 128 if playerInfo is None: # Amua displays it itself 129 AmuaApp().display_song_information() 130 return 114 131 growlNotify(cleanStreamTitle(iTunes.current_stream_title()), 115 132 cleanStreamTrackName(trackName)) … … 133 150 iTunes = iTunesApp() 134 151 if iTunes.player_state() == k.playing: 152 if amuaPlaying(): 153 AmuaApp().display_album_details() 154 return 135 155 url = iTunes.current_stream_URL() 136 156 if url != k.missing_value: … … 155 175 def incrementRatingBy(self, increment): 156 176 iTunes = iTunesApp() 177 if amuaPlaying(): 178 if rating < 0: 179 AmuaApp().ban_song() 180 growlNotify('Banned song.', '') 181 else: 182 AmuaApp().love_song() 183 growlNotify('Loved song.', '') 184 return 157 185 rating = iTunes.current_track.rating() 158 186 rating += increment … … 172 200 if not useStereo: 173 201 needsStereoPowerOn = False 174 iTunes.playpause() 202 if was_playing and amuaPlaying(): 203 AmuaApp().stop() 204 else: 205 iTunes.playpause() 175 206 if not was_playing and iTunes.player_state() == k.stopped: 176 207 # most likely, we're focused on the iPod, so playing does nothing … … 201 232 self.playPause(useStereo=False) 202 233 234 def nextTrack(self): 235 if amuaPlaying(): 236 AmuaApp().skip_song() 237 return 238 iTunesApp().next_track() 239 203 240 def registerZoomWindowHotKey(self): 204 241 self.zoomWindowHotKey = self.registerHotKey(self.zoomWindow, 42, cmdKey | controlKey) # cmd-ctrl-\ … … 236 273 self.registerHotKey(self.playPause, 101) # F9 237 274 self.registerHotKey(lambda: iTunesApp().previous_track(), 109) # F10 238 self.registerHotKey( lambda: iTunesApp().next_track(), 103) # F11275 self.registerHotKey(self.nextTrack, 103) # F11 239 276 self.registerHotKey(lambda: self.incrementRatingBy(-20), 109, shiftKey) # shift-F10 240 277 self.registerHotKey(lambda: self.incrementRatingBy(20), 103, shiftKey) # shift-F11
Note:
See TracChangeset
for help on using the changeset viewer.