Sha256: 9362fd2b15451cdbc6c5725972bb8aeb77e6bc16ada57afbe6711ca99faf4046

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'rockstar'))

# Please enter your API-Keys into lastfm.yml first. 
# You can find them here : http://www.lastfm.de/api/account
Rockstar.lastfm = YAML.load_file(File.join(File.dirname(__FILE__), 'lastfm.yml'))

# This is the desktop app aproach to token auth. See Rockstar::TokenAuth for
# details on how to get a token for a web app.

a = Rockstar::Auth.new
token = a.token

puts
puts "Please open http://www.last.fm/api/auth/?api_key=#{Rockstar.lastfm_api_key}&token=#{token}"
puts
puts "Press enter when done."

gets

session = a.session(token)

Rockstar::Track.scrobble(
  :session_key  => session.key,
  :track        => "Viva La Vida",
  :artist       => "Coldplay",
  :album        => "Viva La Vida",
  :time         => Time.new,
  :length       => 244,
  :track_number => 7
)

# Love the Song :
l_status = Rockstar::Track.new('Coldplay', 'Viva La Vida').love(session.key)

puts "Love track status : #{l_status}"

Rockstar::Track.updateNowPlaying(
  :session_key  => session.key,
  :track        => "Viva La Vida",
  :artist       => "Coldplay",
  :album        => "Viva La Vida",
  :time         => Time.new,
  :length       => 244,
  :track_number => 7
)

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
rockstar-0.8.1 examples/scrobble.rb
rockstar-0.8.0 examples/scrobble.rb
jonaustin-rockstar-0.7.1 examples/scrobble.rb
rockstar-0.7.1 examples/scrobble.rb
rockstar-0.7.0 examples/scrobble.rb
rockstar-0.6.4 examples/scrobble.rb
rockstar-0.6.3 examples/scrobble.rb
rockstar-0.6.2 examples/scrobble.rb
rockstar-custom-0.6.1 examples/scrobble.rb
rockstar-0.6.1 examples/scrobble.rb
rockstar-0.6.0 examples/scrobble.rb
rockstar-0.5.2 examples/scrobble.rb
rockstar-0.5.1 examples/scrobble.rb
rockstar-0.5.0 examples/scrobble.rb