last.fm - Do-It-Yourself Scrobbler (Windows, Linux, OS X)

Overview
lfmCMD - Command Line
lfmCOL - Data Collector
Generic Playlist Transfer
Essential Profile Transfer
Your last.fm Neighbours
Do-It-Yourself Scrobbler
MusicBrainz Scrobbler
Webservice - Word Cloud
iTunes Radio Scrobbler
Site Notice

This webpage describes a Do-It-Yourself Scrobbler for last.fm. You are able to scrobble tracks you have listened to in the past.

Why Do-It-Yourself Scrobbler could be of interest for you:
- You listen often to analog music (vinyl, audio cassettes, bootlegs, ...) ...
- Your music player has no scrobbler build in ...
- You want to batch scrobble very special tracks (setlists, old mix tapes, ...) ...
- Your operating system isn't mainstream, but you have Perl on it ...
- You want to scrobble into more than one account ...
- You plan to create a new scrobbler and needs inspiration ...
- ...
Anyway, you haven't a scrobbler for your demands.

Read further if you think: Yes, I want to build my own scrobbler ...

It's easy to setup and use a private last.fm scrobbler - there are only two prerequisites:
- use the new simplified scrobbling API 2.0
- use the utility lfmCMD.pl out of the box

The new last.fm scrobbling API 2.0 is designed for the submission of now-playing and recent historical track data to last.fm user profiles.

lfmCMD.pl is a small but powerful Perl program. It is a generic last.fm webservices client for Windows, Linux, OS X and allows you to call every last.fm API service (for desktop applications) from a command line / command window (terminal, console).

Submitting a single  track consists of two steps:

- track.updateNowPlaying - Update the 'now playing status' for a user when a track starts playing.

Update your 'now playing status' (this doesn't scrobble the track and is optional; duration is optional but recommended):

perl lfmCMD.pl method=track.updateNowPlaying artist="Def Leppard" album="Hysteria" track="Rocket" duration=398 sk="YourSessionKey"

- track.scrobble - Submit the actual scrobble.

Scrobble the track you are listing to or have listened to:

perl lfmCMD.pl method=track.scrobble artist="Def Leppard" album="Hysteria" track="Rocket" timestamp="1276189000" sk="YourSessionKey"

Submitting multiple (cached) tracks:

Submit a number of scrobbles in one POST request. This should be used when a number of scrobbles have been cached. Multiple scrobbles may be submitted by indexing each scrobble's parameters with an increasing integer from 0 up to a maximum of 49. The tracks must be submitted in chronological order according to when they were listened to (i.e. the track identified by timestamp[0] must have been played before the track identified by timestamp[1]).

Scrobble multiple (max. 50) tracks you have listened to:

perl lfmCMD.pl method=track.scrobble track[0]="Rocket" album[0]="Hysteria" artist[0]="Def Leppard" timestamp[0]="1287153000" track[1]="Women" album[1]="Hysteria" artist[1]="Def Leppard" timestamp[1]="1287152000" sk="YourSessionKey"

E.g. listening history:

Index  Track   Album     Artist       Timestamp (Unix epoch time)
-----  ------  --------  -----------  ------------------------------------------
[0]    Rocket  Hysteria  Def Leppard  1276410255 (Sun, 13 Jun 2010 06:24:15 GMT)
[1]    Women   Hysteria  Def Leppard  1276410600 (Sun, 13 Jun 2010 06:30:00 GMT)
...    ...     ...       ...          ...

Remarks:
- It's not possible to scrobble tracks older than 14 days.
- Submitting scrobbles with duplicate timestamps is permitted.
- It's possible to scrobble up to 2880 tracks per day (86400 / 30 = 2880).
- The timestamp is in Unix epoch time format.

Unix epoch time:
The Unix epoch is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
Helpful link: http://www.epochconverter.com/