PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

MPD Web Radio

Thu Jan 10, 2013 12:03 pm

Hi,

After reading this article on raspberrypi.org on building a web radio, I went ahead and got it up-and-running on my Pi. My only problem is finding good URLs to stream. I've googled and can't find one that works with MPD. I would love to listen to the BBC here in the states. Where can I get a list of URLs?

Thx

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: MPD Web Radio

Thu Jan 10, 2013 1:11 pm

Try the following links:
http://www.radiofeeds.co.uk/mp3.asp
http://di.fm

These sites come with playlist files to start Windows Media Player or Winamp just save and edit them with a text editor to get the URL.
You maybe able to open directly with MPD I know this is possible using Music On Console (mocp).

From what I can tell it's not possible to listen to BBC streams because they're using RTSP which isn't supported by MPD or Music On Console.
You can still listen to the BBC Radio via http://tunein.com but you'll need a Flash Player enabled browser which unfortunately means no Raspberry Pi.

Richard S.

PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

Re: MPD Web Radio

Thu Jan 10, 2013 10:37 pm

Thanks - sounds like more work... not worth all the effort.

Thx

User avatar
bonelifer
Posts: 128
Joined: Thu Jan 12, 2012 4:01 am
Location: http://www.phpbb.com/community/memberli ... e&u=147848
Contact: Website

Re: MPD Web Radio

Thu Jan 10, 2013 11:01 pm

Have you thought about using the RSS Podcasts to download a BBC Radio show. I'm an American and I listen to the "Friday Night Comedy from BBC Radio 4"(as an example):
http://www.bbc.co.uk/podcasts/series/fricomedy

I use cron and gpodders "gpo" commandline client to update and download my podcasts(albeit on my Mythbuntu server). Should work on your Pi. I have the cron setup to update every hour at the hour, then a second cron that starts every hour at 10 minutes after to download.

http://gpodder.org/
Last edited by bonelifer on Thu Jan 10, 2013 11:04 pm, edited 1 time in total.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: MPD Web Radio

Thu Jan 10, 2013 11:03 pm

Actually I was wrong about the BBC it's not all RTSP you can still listen but not in mp3 only wma or aac/aac plus i.e. http://www.radiofeeds.co.uk/aac.asp
If you just want BBC Radio One the URLs for this are:
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_radio1_p?s=1357850400&e=1357864800&h=7fb033ad696d18b247323776e220d528
or
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_radio1_q?s=1357850400&e=1357864800&h=e92b65fb55cccacac538e9e9d9f39a1c
Alternative you could click on the links from the radio page and save the playlist files (.pls) then open with MPD or Music On Console.

Richard S.

User avatar
bonelifer
Posts: 128
Joined: Thu Jan 12, 2012 4:01 am
Location: http://www.phpbb.com/community/memberli ... e&u=147848
Contact: Website

Re: MPD Web Radio

Thu Jan 10, 2013 11:07 pm

redhawk wrote:Actually I was wrong about the BBC it's not all RTSP you can still listen but not in mp3 only wma or aac/aac plus i.e. http://www.radiofeeds.co.uk/aac.asp
If you just want BBC Radio One the URLs for this are:
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_radio1_p?s=1357850400&e=1357864800&h=7fb033ad696d18b247323776e220d528
or
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_radio1_q?s=1357850400&e=1357864800&h=e92b65fb55cccacac538e9e9d9f39a1c
Alternative you could click on the links from the radio page and save the playlist files (.pls) then open with MPD or Music On Console.

Richard S.
They have MP3's at the Podcast download page:
http://www.bbc.co.uk/podcasts

PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

Re: MPD Web Radio

Fri Jan 11, 2013 12:58 am

Thanks - the RSS feeds are the easiest to get the mp3s.. thx

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: MPD Web Radio

Fri Jan 11, 2013 11:49 am

Just a small correction on my previous post the direct URLs to Radio One streaming are dynamically changing basically this means they are valid for a certain amount of time and then fail to work later.
In a nutshell static playlists won't work for BBC Radio stations you'll have to create a script to download the site playlist and play them automatically.

For Music On Console I've knocked up a basic script which should be relatively easy to customise for more BBC stations.
Create a file called bbc then cut and paste the text below followed by chmod +x bbc to make it executable.
#!/bin/bash
case "$1" in
"")
echo "Usage $0 [station] or [stop]"
echo "1 - BBC Radio One"
echo "2 - BBC Radio Two"
exit 0
;;
"1")
url="http://www.bbc.co.uk/radio/listen/live/r1_aaclca.pls"
;;
"2")
url="http://www.bbc.co.uk/radio/listen/live/r2_aaclca.pls"
;;
"stop")
mocp -x
exit 0
;;
esac
if [ ! -z "$url" ]
then
test=`ps aux | fgrep -i mocp`
if [ -z "$test" ]
then
mocp -S
fi
mocp -c
wget -q $url -O bbc.pls
mocp -a bbc.pls
mocp -p
rm -f bbc.pls
fi
To run just type ./bbc 1 for radio one, ./bbc stop to stop playback etc.

Richard S.

PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

Re: MPD Web Radio

Fri Jan 11, 2013 12:18 pm

Nice! I'll give it a go

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: MPD Web Radio

Fri Jan 11, 2013 12:43 pm

There's an error on one line:
test=`ps aux | fgrep -i mocp`
change this to
test=`ps aux | fgrep -v fgrep | fgrep -i mocp`

It's tests for the presence of mocp running but I forgot to filter out fgrep's own command line string. :)

Richard S.

northerndiver
Posts: 7
Joined: Mon Sep 12, 2011 3:37 am

Re: MPD Web Radio

Mon Jan 14, 2013 11:53 am

Can anyone confirm if the streams contained in the r*_aaclca.pls files are working today? I've been using these streams to listen to BBC radio for a few months now, but this morning they arn't working and mpc is not giving any kind of useful error message.

Thanks
Jim

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: MPD Web Radio

Mon Jan 14, 2013 12:48 pm

I've just tried Radio 1, Radio 2 and 1Xtra they're working for me although I'm using Music On Console not MPD.

Richard S.

northerndiver
Posts: 7
Joined: Mon Sep 12, 2011 3:37 am

Re: MPD Web Radio

Mon Jan 14, 2013 2:22 pm

Hmm, I have Radio 4 Extra , Radio 3, and Radio 1 working, but Radio 2 Radio 4 and Radio 6 are all not working. It seems the three channels I listen to most have stopped.

Here is the script I use to play back Radio 2, all the other channels are similar, just replacing the r2_aaclca.pls bits with the appropriate play list file for the desired channel.

Code: Select all

!/bin/bash
rm r2_aaclca*
wget http://www.bbc.co.uk/radio/listen/live/r2_aaclca.pls
grep "File1=" r2_aaclca.pls > streamaddr
mpc clear
mpc add $(sed "s/File1=//g" streamaddr)
mpc play
rm r*_aaclca*

northerndiver
Posts: 7
Joined: Mon Sep 12, 2011 3:37 am

Re: MPD Web Radio

Mon Jan 14, 2013 3:16 pm

Using mplayer I can at least get some error information:-

Code: Select all

pi@raspberrypi ~ $ mplayer "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_6music_q?s=1357820968&e=1357835368&h=ee4c40827e874000b0718d7afeb75ffe"
MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_6music_q?s=1357820968&e=1357835368&h=ee4c40827e874000b0718d7afeb75ffe.
Resolving bbcmedia.ic.llnwd.net for AF_INET...
Connecting to server bbcmedia.ic.llnwd.net[68.142.87.104]: 80...

Server returned 403: Forbidden
STREAM_ASF, URL: http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_6music_q?s=1357820968&e=1357835368&h=ee4c40827e874000b0718d7afeb75ffe
Resolving bbcmedia.ic.llnwd.net for AF_INET...
Connecting to server bbcmedia.ic.llnwd.net[178.79.207.205]: 80...

Server returned 403:Forbidden
Failed to parse header.
Failed, exiting.
Resolving bbcmedia.ic.llnwd.net for AF_INET...
Connecting to server bbcmedia.ic.llnwd.net[68.142.87.104]: 80...

Server returned 403: Forbidden
No stream found to handle url http://bbcmedia.ic.llnwd.net/stream/bbcmedia_lc1_6music_q?s=1357820968&e=1357835368&h=ee4c40827e874000b0718d7afeb75ffe


Exiting... (End of file)
So I'm getting a 403 forbidden, I did wonder if my gateway machine was the problem, but even with squid shut down I'm getting the same error. Next step is to plug my Pi directly into my router.

northerndiver
Posts: 7
Joined: Mon Sep 12, 2011 3:37 am

Re: MPD Web Radio

Mon Jan 14, 2013 3:21 pm

Oops it's all working now, having rebooted my gateway and stopped and started the proxy on it (squid) then everything is back to normal.

doigal
Posts: 3
Joined: Sun Dec 09, 2012 7:39 pm

Re: MPD Web Radio

Fri Feb 01, 2013 12:59 pm

I had the same problem for BBC as well and just grab the direct link from the dynamic file on start up.

See here for the code:
http://www.raspberrypi.org/phpBB3/viewt ... 38&t=28907

Return to “Beginners”