Skip to content

Instantly share code, notes, and snippets.

@N0NamedGuy
Created December 20, 2012 19:24
Show Gist options
  • Select an option

  • Save N0NamedGuy/4347926 to your computer and use it in GitHub Desktop.

Select an option

Save N0NamedGuy/4347926 to your computer and use it in GitHub Desktop.
cec-mpd.py
import sys
from subprocess import call
print "Running!"
while True:
line = sys.stdin.readline()
sp = line.split(" ")
if len(sp) > 2 and sp[-3] == "pressed:":
k = line.split(" ")[-2]
cmd = ""
if (k == "left"):
cmd = "prev"
elif (k == "right"):
cmd = "next"
call(["mpc", cmd])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment