No commit activity in last 3 years
No release in over 3 years
Scrobble tracks to Last.fm without wanting to gnaw your own arm off.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

SimpleScrobbler

Scrobble tracks to Last.fm without wanting to gnaw your own arm off.

Because, probably, all you want to do is just scrobble some tracks. I couldn't find any Ruby libraries/gems that actually worked, so I took some code from James Darling and Chris Mear's Captor hack and tidied it up into a self-contained package.

Usage

Authorise.

require "simple_scrobbler"
ss = SimpleScrobbler.new(api_key, secret, user)
ss.fetch_session_key do |url|
  puts "Go and visit #{url}"
  gets
end

Tell Last.fm what you're listening to.

This is used for realtime display of a user's currently playing track, and does not affect a user's musical profile.

ss.now_playing("Sex Pistols", "Anarchy in the UK")

Scrobble it!

ss.submit("Sex Pistols", "Anarchy in the UK", :length => 211)

Store the session_key for next time.

session_key = ss.session_key

And use it:

ss = SimpleScrobbler.new(api_key, secret, user, session_key)

You can pass in other information to submit and now_playing:

  • :time (for submit only): Time at which the track started playing. Defaults to now
  • :length: Length of the track in seconds (required for submit if the source is P, the default)
  • :album: Album title
  • :track_number: Track number
  • :mb_trackid: MusicBrainz Track ID

If you're listening to a radio station, you'll want to set the source:

ss.source = "R" # Non-personalised broadcast (e.g. Shoutcast, BBC Radio 1).

This will also free you from needing to specify the track length on submit.