Skip to content
Johann Kovacs edited this page Sep 1, 2015 · 1 revision

Important: Please note that this API is deprecated. Although the old scrobbling service is going to stick around for a while, it is recommended to use the new Scrobbling API for new projects. Only use this API if you are maintaining an old project or if you want to use the API with alternative services that are compatible to the old Scrobbler API, such as Libre.fm.

The old API is still available in the de.umass.lastfm.scrobble package, in particular the Scrobbler class. All methods in the Scrobbler class return an instance of ResponseStatus, which you can use to check if the call was executed successfully.

Code Examples

####Connect and authenticate with the scrobbling server:

Scrobbler scrobbler = Scrobbler.newScrobbler("tst", "1.0", username);
ResponseStatus status = scrobbler.handshake(password);
System.out.println("handshake ok: " + status.ok());

Update "now playing" status:

scrobbler.nowPlaying("Pixies", "Where Is My Mind?");

Scrobble track:

scrobbler.submit("Pixies", "Where Is My Mind?", "Surfer Rosa", 233,    7,       Source.USER, (System.currentTimeMillis() / 1000) - 117);
               // Artist,  Title,               Album          length, trackNr, source,      startTime

Clone this wiki locally