Base-Art

Phil's blog

en
Apr 2014
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

Last.FM radios streaming with GStreamer and Python

I'm more and more using Last.FM these days to find fresh artists, track gigs in the city I live in and find people with similar music tastes as me. The Last.FM webradio streaming service is really nice, but not (yet) well documented. So I digged existing clients source code and made mine using Python and GStreamer :-)

The protocol is really simple, relying on HTTP GET requests, hard to do simpler! So I hacked a LastFMSource GStreamer Element which allows to tune station uris and perform commands (love, skip, ban,...) to the current stream. The element is smart enough to update the current track metadatas if it find the "SYNC" string in the input stream. The code is simple enough (I hope!) to be understandable and reusable, so enjoy!

Now I just need some more time to polish the Elisa plugin coming along and using this new Element. The basis is there: a "Last.FM radios" menu listing some stations, press enter to play, you can access commands in another menu... Quite simple no? :)

by Philippe Normand on Sun Feb 4 23:13:50 2007 (Viewed: 36850 / 5 comments )
  |   RSS  |   RSS2  |   Atom  |   Source  |   Edit

#.   synic on Tue Feb 6 02:59:48 2007

Thanks! Exaile SVN now supports Last.FM Streaming support thanks to you!

#.   mh on Wed Feb 7 03:49:45 2007
Strange, gst.BaseSrc gives an error, and I can't find it in the online reference for the Python bindings... (but I only briefly looked at it).
#.   phil on Wed Feb 7 09:51:26 2007

What error do you get? Also, as GStreamer beginner I have made some things the durty way (the buffer_probe, for instance) ;)

I hope to improve the code very soon, when I have a better understanding of the GStreamer machinery

#.   on Wed Feb 7 21:17:20 2007

"AttributeError: 'module' object had no attribute BaseSrc"

I got libgstreamer and gst-python from the debian stable repo (0.8.9-2 and 0.8.1-2)...

M

#.   phil on Wed Feb 7 23:47:09 2007

This was done for GStreamer 0.10. Never tried 0.8, I will add a gst version check, but won't support 0.8. Sorry ;)

Comments not allowed anymore on this post