Changeset 301


Ignore:
Timestamp:
10/01/06 09:41:50 (18 years ago)
Author:
Nicholas Riley
Message:

StreamVision.py: Play/pause VLC or RealPlayer if in front with Logitech headphones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StreamVision/StreamVision.py

    r300 r301  
    156156            else:
    157157                XTensionApp().turnoff('Stereo')
     158
     159    def playPauseFront(self):
     160        systemEvents = app(id='com.apple.systemEvents')
     161        frontName = systemEvents.processes.filter(its.frontmost)[1].name()
     162        if frontName == 'RealPlayer':
     163            realPlayer = app(id='com.RealNetworks.RealPlayer')
     164            if realPlayer.players[0].state.get() == k.playing:
     165                realPlayer.pause()
     166            else:
     167                realPlayer.play()
     168        elif frontName == 'VLC':
     169            app(id='org.videolan.vlc').play() # equivalent to playpause
     170        else:
     171            self.playPause(useStereo=False)     
    158172
    159173    def registerZoomWindowHotKey(self):
     
    212226                iTunesApp().previous_track()
    213227            elif key == kHIDUsage_Csmr_PlayOrPause:
    214                 self.playPause(useStereo=False)
     228                self.playPauseFront()
    215229        super(StreamVision, self).sendEvent_(theEvent)
    216230
Note: See TracChangeset for help on using the changeset viewer.