Last active
          February 21, 2016 15:31 
        
      - 
      
 - 
        
Save aleberg/c9891f2e56b447f20b79 to your computer and use it in GitHub Desktop.  
    Jasper module to start mplayer process / stream internet radio
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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