The Problem

Those of you who listen to the BBC will know that they have a varied and rather excellent collection of radio shows.

Those of you who run Amarok may find it a slightly flaky, but essentially good audio player for the Linux KDE desktop.

Those of you who do both may, like me, wish that the BBC listen again site didn't rely on that awful piece of software known as RealPlayer which really doesn't support Linux very well, and whose web-browser plug-in is the only "official" way of listening to most of the BBC material (although in certain cases - notably listening live - you have the choice of windows media player, which I find works better on Amarok if you have the windows codecs installed).

A Solution

Well, there is now a solution. Okay, it's a proof of concept for the moment. I've looked at the BBC Listen Again page's Javascript and it wasn't especially simple to do, but I think I've managed to find a way to kick out the embedded RealPlayer plug-in and replace it with something else. (Hooray!)

(Now if only Amarok would behave and play realaudio streams to the very end.... Grr!)

Now, I already had a CGI script which controls Amarok. Nothing very flashy, it just presents the basic information, allows you to skip forward and backwards, play, stop, pause and adjust the volume. All I needed to do was to add a few extra functions, notably to a way to tell it to play an rtsp audio stream (or a .rpm RealAudio file which references one).

So that's my solution. If you want to try it yourself, here's the quick overview:

If it works... then you should find that the BBC Listen Again page now plays it's streams in Amarok.

(If you need some more more detail, read on.)

What you need to start

How to install

How do you use them? Well, I'm going to be lazy and assume you know at least the basics about CGI and Apache. I don't currently have time to explain everything, and Google will lead you to a multitude of information if you do a little investigation.

So okay, assuming that you know the basics...

Install the CGI script

The script is available here.

Unpack and copy the CGI script into the CGI enabled location in your user webspace (and remember to set the executable bit (chmod +x amarok)). Lets say you put it in ~/pubic_html/cgi-bin/, and your webspace is visible at http://myserver/~username. It's called amarok, thus you'd use it by visiting http://myserver/~username/cgi-bin/amarok. If Amarok is running, it should tell you what the current track is, and allow you to pause, skip to the next track, etc.

There's also a stylesheet in the package, amarok.css which will make the script look nicer. Put that in a directory above the amarok CGI script (or modify the path to amarok.css in the script).

Install Greasemonkey on Firefox

Greasemonkey is a plugin which can be downloaded from here: https://addons.mozilla.org/en-US/firefox/addon/748

Installation is normally pretty easy, just click on the 'download' link and say 'yes'.

Install the BLAR.user.js script

This is what works the magic spell on the Listen Again page. "B.L.A.R." stands for "BBC Listen Again Retargetter." The current version retargets to my CGI script, but if you're handy with Javascript you may be able to customise it to operate other things, like iTunes, or whatever.

It works for me, if it doesn't for you let me know (politely) and I will try and rectify whatever problems it may have. It's fairly new and untested, so it may have mistakes (yes, I make those), and it's definitely incomplete. On the other hand, if it doesn't work, don't worry, nothing terrible will happen.

If you've got Greasemonkey installed and enabled, you can install BLAR by clicking here and saying 'yes'. The only fiddly bit is this: the script needs to know where your CGI script was installed in the previous step. I can't read your mind so I can't set a default which "just works", so you'll have to edit the script and change the following line to suit yourself.

i.e. if you installed the script at an URL http://myserver/~username/cgi-bin/amarok, you'll need to:

var amarok_url = "http://myserver/~username/cgi-bin/amarok";

Visit the BBC Listen Again website.

This link works for me: http://www.bbc.co.uk/radio/aod/index.shtml

Clicking on a link to play a show should work as normal, except that instead of RealPlayer playing the file locally, it should play it in Amarok. If it does, congratulate yourself!

If it doesn't, err.... well something is obviously wrong.

Projects/ListenAgain (last edited 2008-02-10 17:56:45 by Nick)