Skip to content

Instantly share code, notes, and snippets.

@andrewgodwin
Created March 3, 2016 07:48
Show Gist options
  • Save andrewgodwin/c92ce88c6f4370a76b1e to your computer and use it in GitHub Desktop.
Save andrewgodwin/c92ce88c6f4370a76b1e to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import subprocess
import random
terms = [t.lower() for t in sys.argv[1:]]
if not terms:
print "No search terms supplied"
sys.exit(1)
files = subprocess.Popen(["/usr/bin/find", "-iname", "*.mp3"], stdout=subprocess.PIPE).communicate()[0].split("\n")
files = [x for x in files if any(term in x.lower() for term in terms)]
while True:
file = random.choice(files)
subprocess.call(["/usr/bin/mplayer", "-speed", "1.21", file])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment