Changeset 324


Ignore:
Timestamp:
07/14/07 23:34:16 (17 years ago)
Author:
Nicholas Riley
Message:

StreamVision.py: switch stereo on/off via X10 even if not using F9 to play/pause

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StreamVision/StreamVision.py

    r323 r324  
    7474    pass
    7575
     76needsStereoPowerOn = HAVE_XTENSION
     77
    7678class StreamVision(NSApplication):
    7779
     
    8082
    8183    def displayTrackInfo(self):
     84        global needsStereoPowerOn
     85
    8286        iTunes = iTunesApp()
    8387
     
    8993        if iTunes.player_state() != k.playing:
    9094            growlNotify('iTunes is not playing.', trackName)
    91             return
     95            if HAVE_XTENSION:
     96                if not needsStereoPowerOn and XTensionApp().status('Stereo'):
     97                    XTensionApp().turnoff('Stereo')
     98                needsStereoPowerOn = True
     99            return
     100        if needsStereoPowerOn:
     101            if not XTensionApp().status('Stereo'):
     102                XTensionApp().turnon('Stereo')
     103            needsStereoPowerOn = False
    92104        if trackClass == k.URL_track:
    93105            growlNotify(cleanStreamTitle(iTunes.current_stream_title()),
     
    95107            return
    96108        if trackClass == k.property:
    97            growlNotify('iTunes is playing.', '')
    98            return
     109            growlNotify('iTunes is playing.', '')
     110            return
    99111        kw = {}
    100112        # XXX iTunes doesn't let you get artwork for shared tracks
     
    145157
    146158    def playPause(self, useStereo=True):
     159        global needsStereoPowerOn
     160
    147161        iTunes = iTunesApp()
    148162        was_playing = (iTunes.player_state() == k.playing)
     163        if not useStereo:
     164            needsStereoPowerOn = False
    149165        iTunes.playpause()
    150166        if not was_playing and iTunes.player_state() == k.stopped:
     
    155171            if iTunes.player_state() == k.playing:
    156172                XTensionApp().turnon('Stereo')
     173                needsStereoPowerOn = False
    157174            else:
    158175                XTensionApp().turnoff('Stereo')
     176                needsStereoPowerOn = True
    159177
    160178    def playPauseFront(self):
Note: See TracChangeset for help on using the changeset viewer.