It's cool, most popular music players support last.fm, however problems may occur while you're listening Internet radio stations via a browser (i.e. using flash plugins). I really loved a radio station called Epic Rock Radio, and I always wondered how to scrobble the songs that I am currently listening.
When I accidentally lost all my music files I was encouraged (besides recovering music from my iPad) to implement a scrobbler that could handle online radio stations.
First I made some research, searched the last.fm discussion groups, developers guides and I found just what I was looking for: the Audioscrobbler Realtime Submission Protocol (v1.2 specification available here).
It occurred that last.fm has a RESTful API for purpose of scrobbling songs. A simplified session may be presented as follows:
1. HANDSHAKE / AUTHENTICATION
2. "Now Playing"
3. SUBMIT SONG
Where steps 2-3 may be repeated (in any order) as long as the session key (obtained via HANDSHAKE) is up to date.
After I had a working audioscrobbler it was much easier to implement one for the mentioned radio station (data available in XML from live365.com) :-)
You can find my prototype implementation on github: LastPy
P.S. I wrote it a few years ago, it ain't clean and tidy, but it works ;-)
No comments:
Post a Comment