Last.fm API
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
CHANGELOG
README.rdoc
TODO
init.rb

README.rdoc

Las.fm

API interface to last.fm/

Example

Create auth object:

auth = Marjan::LastFm::Auth.new 'API KEY', 'API SECRET'
auth_url = auth.authorize_url

Rdirect user to auth_url. In your callback action:

auth = Marjan::LastFm::Auth.new 'API KEY', 'API SECRET'
session = auth.get_session :token => params[:token]

Save your session key for later use. Use it:

auth = Marjan::LastFm::Auth.new 'API KEY', 'API SECRET', session['key']
user = Marjan::LastFm::User.new auth
user.get_info

Scrobbling:

Marjan::LastFm::Scrobbler.client_id = 'your client ID'
Marjan::LastFm::Scrobbler.client_version = 'your client version'

s = Marjan::LastFm::Scrobbler.new auth, 'marik_te_ua'
s.handshake!
# tell the world what are you listening right now ;)
s.now_playing Marjan::LastFm::Scrobbler::Notification.new('Rammstein', 'Link 2,3,4')
# save just played track
s.submit Marjan::LastFm::Scrobbler::Submission.new('Rammstein', 'Mutter', (Time.now - 3.minutes).utc.to_i, 'P', '270')

Author

Copyright © 2010 Marjan Krekoten <krekoten@gmail.com>, released under the MIT license