Skip to content

Instantly share code, notes, and snippets.

@konfiot
Last active May 14, 2016 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konfiot/8886406 to your computer and use it in GitHub Desktop.
Save konfiot/8886406 to your computer and use it in GitHub Desktop.
#!/usr/bin/python2.7
import time
import subprocess
from matrix_keypad import RPi_GPIO
kp = RPi_GPIO.keypad(columnCount = 4)
def digit():
r = None
while r==None:
r = kp.getKey()
time.sleep(0.1)
print(r)
return r
process = None
while True :
d = digit()
if d == 1 :
url = 'http://streaming.radio.rtl.fr/rtl-1-44-128'
elif d == 2 :
url = 'http://rfm-live-mp3-128.scdn.arkena.com/rfm.mp3'
elif d == 3 :
url = 'http://adwzg3.tdf-cdn.com/8472/nrj_172793.mp3'
elif d == 4 :
url = 'http://www.listenlive.eu/franceinter128.m3u'
elif d == 5 :
url = 'http://www.listenlive.eu/franceinfo.m3u'
elif d == 6 :
url = 'http://www.listenlive.eu/franceinter128.m3u'
elif d == 7 :
url = 'http://broadcast.infomaniak.net/radioclassique-high.mp3'
else :
print (d)
url=""
if process != None :
process.terminate()
print ("Call : " + url)
process = subprocess.Popen(["play", "-t", "mp3", url], stdout=subprocess.PIPE)
time.sleep(0.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment