I build a new radio.lua script. You can select the radio station via a selector switch.
Based on this topic:
viewtopic.php?t=10672
And this wiki article:
http://www.domoticz.com/wiki/Play_streaming_radio
First install the necessary tool:
Code: Select all
sudo apt-get update
sudo apt-get install mplayerJust make a new selector switch with your favorite name (in my example "Wohnzimmer > Radio"). Add your radio stations with name. Then add a new LUA script and select "Device only" as execution type. Copy the code and change the radio station addresses, the switch name and the switch selector names. Thats all.
The Code:
Code: Select all
--
-- This script play a streaming radio when the device is changed
-- Start files with "mplayer -noconsolecontrols radiostation.mp3 &> /dev/null"
-- Start playlists with "mplayer -noconsolecontrols -playlist radiostation.m3u &> /dev/null"
--
commandArray = {}
if (devicechanged['Wohnzimmer > Radio'] == 'Off') then
os.execute ("killall mplayer")
end
if (devicechanged['Wohnzimmer > Radio'] == '1FM') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://uk2.internet-radio.com:8358/ &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == '1LIVE') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols https://wdr-1live-live.icecastssl.wdr.de/wdr/1live/live/mp3/128/stream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'Bayern 3') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://br-br3-live.cast.addradio.de/br/br3/live/mp3/128/stream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'MDR Jump') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://mdr-284320-0.cast.mdr.de/mdr/284320/0/mp3/high/stream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'Radio Berg') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://edge.live.mp3.mdn.newmedia.nacamar.net/radioberg/livestream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'SWR1 Rheinland-Pfalz') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://swr-swr1-rp.cast.addradio.de/swr/swr1/rp/mp3/128/stream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'SWR3') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://swr-swr3-live.cast.addradio.de/swr/swr3/live/mp3/128/stream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'WDR2 Bergisches Land') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols https://wdr-wdr2-bergischesland.icecastssl.wdr.de/wdr/wdr2/bergischesland/mp3/128/stream.mp3 &> /dev/null")
end
if (devicechanged['Wohnzimmer > Radio'] == 'WDR4') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols https://wdr-wdr4-live.icecastssl.wdr.de/wdr/wdr4/live/mp3/128/stream.mp3 &> /dev/null")
end
return commandArray
Code: Select all
commandArray['Variable:Wohnzimmer > Radio Senderspeicher'] = '10'