Scrobble with Delphi
The term "scrobble" is an invention of Last.fm. It describes the process to publish the current song(s) in your playlist on your LastFM useraccount. After you scrobbled some songs, you can search for people with similar taste in music, get to know other songs you may like and so on. Just some Web2.0-stuff with music.
ScrobblerUtils implements the used protocol and encapsulates the needed calls. It can be integrated into an existing code by extending it as follows.
- ScrobblerUtils sends several messages to the application main window, as the communication with the LastFM-server runs in a seperate thread. You have to receive and handle these messages. See the demo application for details.
- The user should be guided through the authentification. Basically just three clicks, but the second one is a button on the LastFM website, where the user have to grant your application access to his account.
- On Play, Stop, Pause, Next Song in your application, a matching line (or two of them) of scrobbler-code like "AppScrobbler.PlaybackPaused;" must be inserted into your code
All the other stuff ist done in the background, i.e. ScrobbleUtils checks whether the song should be scrobbled at all (short or aborted songs are not scrobbled, just the "Now playing notification" is allowed in this case), and songs are cached when the connection is not available at a given time.
Third-party components, IDE
Tested with Delphi 7 Personal and Delphi 2009 Professional
Indy components (version 10)
A Unit for computing MD5-hashes (included)
MPL 1.1 or LGPL 2.1 with the following restrictions
In the demo-application an API-Key and matching secret is used, which should only be used for demonstration purposes. The user will get a warning during the authentification with this key. If you want to use this unit: Get a key/secret for yourself - there are just a few clicks necessary on Last.fm
"Client-ID" and "Version" are "tst" and "1.0" in the demo application. These values are only allowed for development, not for published software. If you want to publish your software: Contact LastFM for your own ID!