Created
March 31, 2010 14:01
-
-
Save jackregnart/350343 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, os, subprocess | |
launch = True | |
blocker = "" | |
apps = ["Spotify", "Songbird", "VLC"] | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment