LinHES Forums
http://forum.linhes.org/

Stream KEXP (radio) with the touch of a button
http://forum.linhes.org/viewtopic.php?f=3&t=3194
Page 1 of 1

Author:  mdrovdahl [ Fri Jan 07, 2005 9:29 am ]
Post subject:  Stream KEXP (radio) with the touch of a button

Seattle is home to one of the world's great public radio stations- KEXP. Outside of NPR, it's the only radio my wife or I listen to. I tried mythstream, but it was difficult for my wife to use. So, I mapped the "radio" button on my Hauppauge grey remote to launch their streaming feed in mplayer. Once launched, the volume controls work and the stop key kills the stream. I'm not much of a programmer, so please critique and/or improve upon my little script- it's simply a derivative of the "wife friendly" reboot solution.

Here's my /home/mythtv/.mythtv/lircrc (still a work in progress)
Code:
# lircrc.example.HauppaugeGrey-nativelirc
# 2003-09-17, Robert Kulagowski
# mailto:rkulagow@rocketmail.com
# Save this file in ~/.mythtv/lircrc

# Wife Friendly Feature
# needs work
# Power Button
begin
        prog = irexec
        button = POWER
        repeat = 4
        config = /usr/local/bin/mythpowerbutton.sh
end

# stream kexp
begin
    prog = irexec
    button = Radio
    config = /usr/local/bin/kexpbutton.sh
    repeat = 0
end

# jumpoints
begin
    prog = mythtv
    button = TV
# switch to live tv
    config = F5
end

begin
    prog = mythtv
    button = Blue
    config = F6
# mythweather module
end

begin
    prog = mythtv
    button = Pictures
    config = F7
# mythgallery module
end

begin
    prog = mythtv
    button = Music
    config = F8
# mythmuisc module
end

begin
    prog = mythtv
    button = Videos
    config = F12
# mythvideo module
end

# display help dialog
begin
    prog = mythtv
    button = Go
    config = F1 
end

begin
    prog = mythtv
    button = 1
    config = 1 
end

begin
    prog = mythtv
    button = 2
    config = 2 
end

begin
    prog = mythtv
    button = 3
    config = 3 
end

begin
    prog = mythtv
    button = 4
    config = 4 
end

begin
    prog = mythtv
    button = 5
    config = 5 
end

begin
    prog = mythtv
    button = 6
    config = 6 
end

begin
    prog = mythtv
    button = 7
    config = 7 
end

begin
    prog = mythtv
    button = 8
    config = 8 
end

begin
    prog = mythtv
    button = 9
    config = 9 
end

begin
    prog = mythtv
    button = Back/Exit
    config = Esc
end

begin
    prog = mythtv
    button = 0
    config = 0 
end

begin
    prog = mythtv
    button = Guide
    config = M 
end

# Below are keys used with the Hauppauge Grey remote

begin
   prog = mythtv
# This is the Red key
# We'll use it for "Delete"
   button = Red
   config = D 
end

begin
   prog = mythtv
# We'll use it for "Information"
   button = Menu/i
   config = I 
end

# Note the "repeat =" strings in the volume and channel.
# This means that if you hold down the key, every nth instance will be
# passed.  This depends on your system, so you may want to increase or
# decrease this and see what happens.  repeat = 1 is probably too
# fast.

begin
  prog = mythtv
  button = Vol-
  repeat = 3
  config = F10 
end

begin
  prog = mythtv
  button = Vol+
  repeat = 3
  config = F11 
end

begin
    prog = mythtv
    button = Up
# This is the "up" on the central diamond
    repeat = 3
    config = Up
end

begin
    prog = mythtv
    button = Down
# This is the "down" on the central diamond
    repeat = 3
    config = Down
end

begin
    prog = mythtv
    button = Left
# This is the "left" on the central diamond
    repeat = 3
    config = Left
end

begin
    prog = mythtv
    button = Right
# This is the "right" on the central diamond
    repeat = 3
    config = Right
end

begin
    prog = mythtv
# Middle button on the diamond
    button = Ok
    config = Return
end

begin
    prog = mythtv
    button = Mute
    config = F9 
end

# NA
begin
   prog = mythtv
# Change focus for PiP (to change channel in the other window)
   button = Blank
   config = B 
end

# NA
begin
   prog = mythtv
# Toggle PiP on/off
   button = Full
   config = V 
end

begin
    prog = mythtv
    button = Rewind
    config = < 
end

begin
    prog = mythtv
    button = Play
    config = P 
end

begin
    prog = mythtv
    button = Forward
    config = > 
end

begin
  prog = mythtv
  button = Record
  config = R 
end

# NA
begin
   prog = mythtv
# Teletext
   button = blank
   config = T 
end

begin
    prog = mythtv
    button = pause
    config = P 
end

begin
   prog = mythtv
   button = Replay/SkipBackward
# Use for backwards commercial skip
    config = Q 
end

begin
   prog = mythtv
   button = SkipForward
# Use for forward commercial skip
    config = Z 
end

#MPlayer
begin
   prog = mplayer
   button = BACK/EXIT
   config = quit
end
                   
begin
   prog = mplayer
   button = Stop
   config = quit
end

begin
   prog = mplayer
   button = Menu/i
   config = osd
end
                             
begin
   prog = mplayer
   button = Rewind
   config = seek -10
   repeat = 1
end
                                                             
begin
   prog = mplayer
   button = Forward
   config = seek +10
   repeat = 1
end

begin
   prog = mplayer
   button = Replay/SkipBackward
   config = seek -60
   repeat = 1
end

begin
   prog = mplayer
   button = SkipForward
   config = seek +60
   repeat = 1
end

begin
    prog = mplayer
    button = Pause
    config = pause
end

begin
   prog = mplayer
   button = VOL+
   config = volume +1
   repeat = 1
end

begin
   prog = mplayer
   button = VOL-
   config = volume -1
   repeat = 1
end

begin
   prog=mplayer
   button=Mute
   config=mute
end


And, here's the bash script /usr/local/bin/kexpbutton.sh
Code:
#!/bin/sh

i=`ps aux | grep mplayer | sed -e 's/.*grep.*//'`

if [ -n "$i" ]
then
        killall mplayer
else
        mplayer http://kexp-mp3-2.cac.washington.edu:8000
fi


Then, tell fvwm to launch irexec on login by adding this line to the bottom of /home/mythtv/.fvwm/.fvwm2rc
Code:
#Remove comment to start motion
#exec motion
#Start irexec for global buttons- KEXP and wife friendly feature
    exec irexec &
exec KnoppMyth-run
#exec mythfrontend
#Enjoy!  Cecil & Dale
#End


Make sure to chmod +x the bash script and set the permissions correct. Also, be aware that mythtv retains the remote's focus so that you can navigate the MythUI while the stream plays- I like to combine listening to KEXP with a gallery slide show.

Happy Friday everyone.
Mark

Author:  xtopher [ Sat Jan 08, 2005 6:48 pm ]
Post subject: 

this is fascinating, and what i have been looking for.

there is only one net radio station that i listen to.

Http://digitalgunfire.com

i was wondering if i could just swap out the stream address, and run it.

maybe if i feel brave next weekend i might give it a try.

Author:  siliconsurfer [ Wed Jan 19, 2005 3:48 pm ]
Post subject:  Yes Cheers

Likewise! I only listen to virgin radio.

It allows you download a .pls (Play list) from it's website, which xmms can then play. Unfortunatly myth doesn't seem to support pls files,

But your solution is excellent, well done!

Author:  jimmyfergus [ Sat Jan 22, 2005 9:48 am ]
Post subject: 

Greetings fellow KEXP fan! KEXP is the business! I used to live in Seattle, and listened on FM, then moved to the UK and now to MA, USA, and KEXP is the only station I can stand to listen to. I've turned many people onto it. Totally non-commercial, good music, good mix of recent and older stuff. In my opinion, the weekend programming (particularly 9am-midday), and many of the 6-9pm weekday evening programs are a bit weak, but the rest is superb. It's my workday background music all the time.

When I get other things set up properly, Ill be trying to get their real audio stream (~280kbit), which is much higher quality than their mp3 or wma streams (96kbit).

Author:  magic [ Sat Nov 05, 2005 9:39 pm ]
Post subject:  Some updates

Thanks for the great script. I also am a big KEXP fan.

I just installed R5A22, and I think they have changed from fvwm to fluxbox. There are two changes required.

Add this line to your /home/mythtv/.fluxbox/apps file towards the top.

Code:
[startup] {irexec  /home/mythtv/.mythtv/lircrc &}


And add the "&" to the mplayer command in /usr/local/bin/kexpbutton.sh like below
Code:
#!/bin/sh

i=`ps aux | grep mplayer | sed -e 's/.*grep.*//'`

if [ -n "$i" ]
then
        killall mplayer
else
        mplayer http://kexp-mp3-2.cac.washington.edu:8000 &
fi


enjoy!
magic

Author:  dmcallister [ Fri Nov 16, 2007 9:52 pm ]
Post subject:  The great Drovdahl Magic with KEXP

:o
Thanks fellas for the great tips.

KEXP is the best station out there.

Long live the WMPNNIB (Worlds Most Powerfull Non Nuclear Ice Breaker)

DMc

Author:  mythedoff [ Sat Nov 17, 2007 11:59 am ]
Post subject: 

KEXP also has an uncompressed stream that could be used in the script. Here's what I have in my /myth/stream/streams.res

[item]
Radio
KEXP Live uncompressed
mms://media-wm.cac.washington.edu/KEXP-Uncompressed
[emptystring]
[emptystring]

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/