SHOUTcast search

March 6, 2010

[Warning: This post is a backup recovery from my previous Wordpress blog. All content was automatically converted accessing a MySQL database using a Python script (details). Mostly are in Portuguese but if you are interest I can translate to English. If you found any problem dont’t hesitate to contact me in comments.]

I'm working on a project using SHOUTCast. In order to know about services requests, especially XML output, I made this small program to display search queries. The program perform an Http request and parse the result in a appropriate view.

screenshot

This code is hosted in Github.

$ git clone git://github.com/maluta/shoutcast-search.git 
$ cd shoutcast-search 
$ qmake && make && ./shoutcast-search

To listen some radio I cut & paste 'Playlist' info and put in some player. For example, to listen the Bob Dylan radio selected in screenshot I would do:

curl -s http://yp.shoutcast.com/sbin/tunein-station.pls?id=486</p>
[playlist] numberofentries=2 File1=http://68.90.68.227:8001 Title1=(#1 - 11/55) DylanRadio.com Length1=-1 File2=http://66.55.139.212:7190 Title2=(#2 - 30/50) DylanRadio.com Length2=-1 Version=2

As you can see, ouput has two URLs, so I select one and choose mplayer to play.

mplayer http://68.90.68.227:8001

Enjoy :-)

Bonus: A not beautiful way to play from command line…

curl -s http://... | egrep "^File1" | cut -c7- | xargs mplayer