Created
March 3, 2016 07:48
-
-
Save andrewgodwin/c92ce88c6f4370a76b1e to your computer and use it in GitHub Desktop.
This file contains 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/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