Last.fm integration in other players
From Arnout Engelen
I asked what other people think about this in this thread on the last.fm forum
The last.fm player uses RtAudio, a common API for realtime audio input/output across Linux (native ALSA, Jack, and OSS), SGI, Macintosh OS X (CoreAudio), and Windows (DirectSound and ASIO) operating systems.
Contents |
[edit] The Interface
Looks like the easiest way to find out how last.fm works is by looking at the LastFMProxy source.
[edit] Changing channels
Log in by visiting wsdev.audioscrobbler.com:80/radio/handshake.php?version=1.0.1&platform=linux&username=" + username + "&passwordmd5=" + password. The response gives name=value pairs, including a 'session' and a 'stream_url'.
Change channels
/adjust.php?session=" + self.info["session"] + "&url=" + url)
URL's of the form: lastfm:/ enz
Give commands
/control.php?command=" + cmd + "&session=" + self.info["session"])
[edit] Getting metadata
/np.php?session=" + self.info["session"]
Again name=value pairs, including 'streaming' (may be 'false'), possibly 'artist', 'track', 'trackprogress', 'trackduration', 'album', 'album_url'.
[edit] Getting the mp3 stream
Connect to stream_url and send:
GET /(last part of stream_url) HTTP/1.0\r\n Host: (host part of stream_url)\r\n \r\n
Now simply read the data from the stream...
