Skip to content

krekoten/last_fm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 <[email protected]>, released under the MIT license

About

Last.fm API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages