Skip to content

Instantly share code, notes, and snippets.

@aleberg
Last active February 21, 2016 15:31
Show Gist options
  • Save aleberg/c9891f2e56b447f20b79 to your computer and use it in GitHub Desktop.
Save aleberg/c9891f2e56b447f20b79 to your computer and use it in GitHub Desktop.
Jasper module to start mplayer process / stream internet radio
import re
from urllib2 import URLError
import os
import signal
import subprocess
WORDS = ["RADIO"]
def handle(text, mic, profile):
try:
#plays radio Landsberg
pro = subprocess.Popen('mplayer http://80.237.154.83:8120', shell=True)
#os.killpg(os.getpgid(pro.pid), signal.SIGTERM)
except URLError, e:
mic.say("I am unable to play radio.")
def isValid(text):
radio = bool(re.search(r'\Radio\b',text, re.IGNORECASE))
if radio :
return True
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment