Skip to content

Instantly share code, notes, and snippets.

@jackregnart
Created March 31, 2010 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackregnart/350343 to your computer and use it in GitHub Desktop.
Save jackregnart/350343 to your computer and use it in GitHub Desktop.
#!/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