Changeset 667


Ignore:
Timestamp:
08/06/13 23:50:41 (6 years ago)
Author:
Nicholas Riley
Message:

StreamVision?.py: Remove unused import; convert tabs to spaces; die on
logout so we don't keep restarting iTunes over and over again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StreamVision/StreamVision.py

    r666 r667  
    1616import httplib2
    1717import os
    18 import struct
    1918import scrape
    2019import HotKey
     
    6766    url = session.region.firsttag('a')['href']
    6867    if not url.startswith('http'):
    69         url = 'http://www.radioparadise.com/rp2-' + url
    70         return url
     68        url = 'http://www.radioparadise.com/rp2-' + url
     69        return url
    7170
    7271def cleanStreamTitle(title):
     
    319318        systemEvents = app(id='com.apple.systemEvents')
    320319        frontName = systemEvents.processes[its.frontmost == True][1].name()
    321         if frontName == 'RealPlayer':
    322             realPlayer = app(id='com.RealNetworks.RealPlayer')
    323             if len(realPlayer.players()) > 0:
    324                 if realPlayer.players[1].state() == k.playing:
    325                     realPlayer.pause()
    326                 else:
    327                     realPlayer.play()
    328                 return
    329         elif frontName == 'VLC':
    330             app(id='org.videolan.vlc').play() # equivalent to playpause
    331         else:
    332             self.playPause(useStereo=False)
     320        if frontName == 'RealPlayer':
     321            realPlayer = app(id='com.RealNetworks.RealPlayer')
     322            if len(realPlayer.players()) > 0:
     323                if realPlayer.players[1].state() == k.playing:
     324                    realPlayer.pause()
     325                else:
     326                    realPlayer.play()
     327                return
     328        elif frontName == 'VLC':
     329            app(id='org.videolan.vlc').play() # equivalent to playpause
     330        else:
     331            self.playPause(useStereo=False)
    333332
    334333    def nextTrack(self):
     
    384383        self.registerHotKey(lambda: self.incrementRatingBy(20), 103, shiftKey) # shift-F11
    385384        self.registerZoomWindowHotKey()
    386         NSDistributedNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, self.displayTrackInfo, 'com.apple.iTunes.playerInfo', None)
     385
     386        distributedNotificationCenter = NSDistributedNotificationCenter.defaultCenter()
     387        distributedNotificationCenter.addObserver_selector_name_object_(self, self.displayTrackInfo, 'com.apple.iTunes.playerInfo', None)
     388        distributedNotificationCenter.addObserver_selector_name_object_(self, self.terminate_, 'com.apple.logoutContinued', None)
    387389        try:
    388390            import HIDRemote
Note: See TracChangeset for help on using the changeset viewer.