Pastebin.no - Hele Norges Pastebin!


Ditt bilde her?
Nick:Christian
Emne/feilmelding:http://christian.tellnes.com/?p=134
Dato/tid:10.05.2010 18:22
Språk:
Sponsede Lenker:


001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
#!/usr/bin/env python
import sys, os, subprocess
 
launch = True
blocker = ""
apps = ["Ecoute", "Spotify", "Songbird", "Mplayer OSX Extended", "Mplayer"]
 
ps = subprocess.Popen("/bin/ps -x", shell=True, stdout=subprocess.PIPE)
 
for line in ps.stdout.read().split("\n"):
        for app in apps:
                if app in line:
                        launch = False
                        blocker = app
 
ps.stdout.close()
 
if launch :
        os.spawnvp(os.P_WAIT, '/Applications/iTunes.app/Contents/MacOS/iTunesX', sys.argv)
else :
        print "Not launching iTunes while %s is running." % blocker