Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for scrobbling and now playing submission

  • Loading branch information...
commit 2f243cfc04febb1b854cf2ed8c0b108b31a487b3 1 parent 2ab0827
@titanous titanous authored
View
1  History.txt
@@ -1 +1,2 @@
+* v 0.2.0: added support for scrobbling tracks and now playing submission (Titanous)
* v 0.1.0: initial release
View
4 Manifest.txt
@@ -8,6 +8,7 @@ examples/artist.rb
examples/tag.rb
examples/track.rb
examples/user.rb
+examples/scrobble.rb
lib/scrobbler.rb
lib/scrobbler/album.rb
lib/scrobbler/artist.rb
@@ -18,6 +19,9 @@ lib/scrobbler/tag.rb
lib/scrobbler/track.rb
lib/scrobbler/user.rb
lib/scrobbler/version.rb
+lib/scrobbler/simpleauth.rb
+lib/scrobbler/scrobble.rb
+lib/scrobbler/playing.rb
test/test_helper.rb
test/fixtures/xml/album/info.xml
test/fixtures/xml/artist/fans.xml
View
38 README.txt
@@ -68,4 +68,40 @@ Below is just a sampling of how easy this lib is to use.
track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats')
puts 'Fans'
puts "=" * 4
- track.fans.each { |u| puts "(#{u.weight}) #{u.username}" }
+ track.fans.each { |u| puts "(#{u.weight}) #{u.username}" }
+
+== Simple Authentication (for Scrobbling)
+
+ auth = Scrobbler::SimpleAuth.new(:user => 'chunky', :password => 'bacon')
+ auth.handshake!
+
+ puts "Auth Status: #{auth.status}"
+ puts "Session ID: #{auth.session_id}"
+ puts "Now Playing URL: #{auth.now_playing_url}"
+ puts "Submission URL: #{auth.submission_url}"
+
+== Scrobbling
+
+ scrobble = Scrobbler::Scrobble.new(:session_id => auth.session_id,
+ :submission_url => auth.submission_url,
+ :artist => 'Coldplay',
+ :track => 'Viva La Vida',
+ :album => "Viva La Vida",
+ :time => Time.new,
+ :length => 244,
+ :track_number => 7)
+ scrobble.submit!
+ puts "Scrobbler Submission Status: #{scrobble.status}"
+
+== Now Playing Submission
+
+ playing = Scrobbler::Playing.new(:session_id => auth.session_id,
+ :now_playing_url => auth.now_playing_url,
+ :artist => 'Anberlin',
+ :track => 'Readyfuels',
+ :album => 'Blueprints For the Black Market',
+ :length => 218,
+ :track_number => 1)
+
+ playing.submit!
+ puts "Playing Submission Status: #{playing.status}"
View
6 lib/scrobbler.rb
@@ -1,5 +1,7 @@
%w{cgi rubygems hpricot active_support}.each { |x| require x }
+$: << File.expand_path(File.dirname(__FILE__))
+
require 'scrobbler/base'
require 'scrobbler/album'
@@ -9,5 +11,9 @@
require 'scrobbler/tag'
require 'scrobbler/track'
+require 'scrobbler/simpleauth'
+require 'scrobbler/scrobble'
+require 'scrobbler/playing'
+
require 'scrobbler/rest'
require 'scrobbler/version'
View
4 lib/scrobbler/version.rb
@@ -1,8 +1,8 @@
module Scrobbler #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
- MINOR = 1
- TINY = 1
+ MINOR = 2
+ TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
Please sign in to comment.
Something went wrong with that request. Please try again.