xhochy-scrobbler 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/MIT-LICENSE +19 -0
- data/Manifest +65 -0
- data/README.rdoc +114 -0
- data/Rakefile +36 -0
- data/examples/album.rb +17 -0
- data/examples/artist.rb +13 -0
- data/examples/scrobble.rb +31 -0
- data/examples/tag.rb +11 -0
- data/examples/track.rb +6 -0
- data/examples/user.rb +14 -0
- data/lib/scrobbler.rb +22 -0
- data/lib/scrobbler/album.rb +140 -0
- data/lib/scrobbler/artist.rb +134 -0
- data/lib/scrobbler/base.rb +82 -0
- data/lib/scrobbler/chart.rb +31 -0
- data/lib/scrobbler/playing.rb +49 -0
- data/lib/scrobbler/rest.rb +47 -0
- data/lib/scrobbler/scrobble.rb +66 -0
- data/lib/scrobbler/search.rb +60 -0
- data/lib/scrobbler/simpleauth.rb +59 -0
- data/lib/scrobbler/tag.rb +93 -0
- data/lib/scrobbler/track.rb +89 -0
- data/lib/scrobbler/user.rb +173 -0
- data/lib/scrobbler/version.rb +3 -0
- data/scrobbler.gemspec +41 -0
- data/setup.rb +1585 -0
- data/test/fixtures/xml/album/info.xml +43 -0
- data/test/fixtures/xml/artist/fans.xml +52 -0
- data/test/fixtures/xml/artist/similar.xml +1004 -0
- data/test/fixtures/xml/artist/topalbums.xml +61 -0
- data/test/fixtures/xml/artist/toptags.xml +19 -0
- data/test/fixtures/xml/artist/toptracks.xml +62 -0
- data/test/fixtures/xml/search/album.xml +241 -0
- data/test/fixtures/xml/search/artist.xml +215 -0
- data/test/fixtures/xml/search/track.xml +209 -0
- data/test/fixtures/xml/tag/topalbums.xml +805 -0
- data/test/fixtures/xml/tag/topartists.xml +605 -0
- data/test/fixtures/xml/tag/toptags.xml +1254 -0
- data/test/fixtures/xml/tag/toptracks.xml +852 -0
- data/test/fixtures/xml/track/fans.xml +34 -0
- data/test/fixtures/xml/track/toptags.xml +33 -0
- data/test/fixtures/xml/user/friends.xml +30 -0
- data/test/fixtures/xml/user/neighbours.xml +23 -0
- data/test/fixtures/xml/user/profile.xml +12 -0
- data/test/fixtures/xml/user/recentbannedtracks.xml +24 -0
- data/test/fixtures/xml/user/recentlovedtracks.xml +24 -0
- data/test/fixtures/xml/user/recenttracks.xml +47 -0
- data/test/fixtures/xml/user/systemrecs.xml +18 -0
- data/test/fixtures/xml/user/topalbums.xml +61 -0
- data/test/fixtures/xml/user/topartists.xml +41 -0
- data/test/fixtures/xml/user/toptags.xml +44 -0
- data/test/fixtures/xml/user/toptracks.xml +65 -0
- data/test/mocks/rest.rb +102 -0
- data/test/test_helper.rb +20 -0
- data/test/unit/album_test.rb +73 -0
- data/test/unit/artist_test.rb +106 -0
- data/test/unit/chart_test.rb +34 -0
- data/test/unit/playing_test.rb +53 -0
- data/test/unit/scrobble_test.rb +69 -0
- data/test/unit/search_test.rb +55 -0
- data/test/unit/simpleauth_test.rb +45 -0
- data/test/unit/tag_test.rb +58 -0
- data/test/unit/track_test.rb +37 -0
- data/test/unit/user_test.rb +201 -0
- metadata +175 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
# exception definitions
|
4
|
+
class BadAuthError < StandardError; end
|
5
|
+
class BannedError < StandardError; end
|
6
|
+
class BadTimeError < StandardError; end
|
7
|
+
module Scrobbler
|
8
|
+
AUTH_URL = 'http://post.audioscrobbler.com'
|
9
|
+
AUTH_VER = '1.2.1'
|
10
|
+
|
11
|
+
class SimpleAuth
|
12
|
+
# you should read last.fm/api/submissions#handshake
|
13
|
+
|
14
|
+
attr_accessor :user, :password, :client_id, :client_ver
|
15
|
+
attr_reader :status, :session_id, :now_playing_url, :submission_url
|
16
|
+
|
17
|
+
def initialize(args = {})
|
18
|
+
@user = args[:user] # last.fm username
|
19
|
+
@password = args[:password] # last.fm password
|
20
|
+
@client_id = 'rbs' # Client ID assigned by last.fm; Don't change this!
|
21
|
+
@client_ver = Scrobbler::Version
|
22
|
+
|
23
|
+
raise ArgumentError, 'Missing required argument' if @user.blank? || @password.blank?
|
24
|
+
|
25
|
+
@connection = REST::Connection.new(AUTH_URL)
|
26
|
+
end
|
27
|
+
|
28
|
+
def handshake!
|
29
|
+
password_hash = Digest::MD5.hexdigest(@password)
|
30
|
+
timestamp = Time.now.to_i.to_s
|
31
|
+
token = Digest::MD5.hexdigest(password_hash + timestamp)
|
32
|
+
|
33
|
+
query = { :hs => 'true',
|
34
|
+
:p => AUTH_VER,
|
35
|
+
:c => @client_id,
|
36
|
+
:v => @client_ver,
|
37
|
+
:u => @user,
|
38
|
+
:t => timestamp,
|
39
|
+
:a => token }
|
40
|
+
result = @connection.get('/', query)
|
41
|
+
|
42
|
+
@status = result.split(/\n/)[0]
|
43
|
+
case @status
|
44
|
+
when /OK/
|
45
|
+
@session_id, @now_playing_url, @submission_url = result.split(/\n/)[1,3]
|
46
|
+
when /BANNED/
|
47
|
+
raise BannedError # something is wrong with the gem, check for an update
|
48
|
+
when /BADAUTH/
|
49
|
+
raise BadAuthError # invalid user/password
|
50
|
+
when /FAILED/
|
51
|
+
raise RequestFailedError, @status
|
52
|
+
when /BADTIME/
|
53
|
+
raise BadTimeError # system time is way off
|
54
|
+
else
|
55
|
+
raise RequestFailedError
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Below is code samples for how to find the top albums and tracks for a tag.
|
2
|
+
#
|
3
|
+
# tag = Scrobbler::Tag.new('country')
|
4
|
+
#
|
5
|
+
# puts 'Top Albums'
|
6
|
+
# tag.top_albums.each { |a| puts "(#{a.count}) #{a.name} by #{a.artist}" }
|
7
|
+
#
|
8
|
+
# puts
|
9
|
+
#
|
10
|
+
# puts 'Top Tracks'
|
11
|
+
# tag.top_tracks.each { |t| puts "(#{t.count}) #{t.name} by #{t.artist}" }
|
12
|
+
#
|
13
|
+
# Which would output something similar to:
|
14
|
+
#
|
15
|
+
# Top Albums
|
16
|
+
# (29) American IV: The Man Comes Around by Johnny Cash
|
17
|
+
# (14) Folks Pop In at the Waterhouse by Various Artists
|
18
|
+
# (13) Hapless by Flowers From The Man Who Shot Your Cousin
|
19
|
+
# (9) Taking The Long Way by Dixie Chicks
|
20
|
+
# (8) Unchained by Johnny Cash
|
21
|
+
# (8) American III: Solitary Man by Johnny Cash
|
22
|
+
# (8) Wide Open Spaces by Dixie Chicks
|
23
|
+
# (7) It's Now or Later by Tangled Star
|
24
|
+
# (7) Greatest Hits by Hank Williams
|
25
|
+
# (7) American Recordings by Johnny Cash
|
26
|
+
# (6) Forgotten Landscape by theNoLifeKing
|
27
|
+
# (6) At Folsom Prison by Johnny Cash
|
28
|
+
# (6) Fox Confessor Brings the Flood by Neko Case
|
29
|
+
# (6) Murder by Johnny Cash
|
30
|
+
# (5) Gloom by theNoLifeKing
|
31
|
+
# (5) Set This Circus Down by Tim McGraw
|
32
|
+
# (5) Blacklisted by Neko Case
|
33
|
+
# (5) Breathe by Faith Hill
|
34
|
+
# (5) Unearthed (disc 4: My Mother's Hymn Book) by Johnny Cash
|
35
|
+
# (4) Home by Dixie Chicks
|
36
|
+
#
|
37
|
+
# Top Tracks
|
38
|
+
# (221) Hurt by Johnny Cash
|
39
|
+
# (152) I Walk the Line by Johnny Cash
|
40
|
+
# (147) Ring of Fire by Johnny Cash
|
41
|
+
# (125) Folsom Prison Blues by Johnny Cash
|
42
|
+
# (77) The Man Comes Around by Johnny Cash
|
43
|
+
# (67) Personal Jesus by Johnny Cash
|
44
|
+
# (65) Not Ready To Make Nice by Dixie Chicks
|
45
|
+
# (63) Before He Cheats by Carrie Underwood
|
46
|
+
# (62) Give My Love to Rose by Johnny Cash
|
47
|
+
# (49) Jackson by Johnny Cash
|
48
|
+
# (49) What Hurts The Most by Rascal Flatts
|
49
|
+
# (48) Big River by Johnny Cash
|
50
|
+
# (46) Man in Black by Johnny Cash
|
51
|
+
# (46) Jolene by Dolly Parton
|
52
|
+
# (46) Friends in Low Places by Garth Brooks
|
53
|
+
# (46) One by Johnny Cash
|
54
|
+
# (44) Cocaine Blues by Johnny Cash
|
55
|
+
# (41) Get Rhythm by Johnny Cash
|
56
|
+
# (41) I Still Miss Someone by Johnny Cash
|
57
|
+
# (40) The Devil Went Down to Georgia by Charlie Daniels Band
|
58
|
+
module Scrobbler
|
59
|
+
class Tag < Base
|
60
|
+
attr_accessor :name, :count, :url
|
61
|
+
|
62
|
+
class << self
|
63
|
+
def new_from_xml(xml, doc=nil)
|
64
|
+
name = xml.at(:name).inner_html
|
65
|
+
t = Tag.new(name)
|
66
|
+
t.count = xml.at(:count).inner_html if xml.at(:count)
|
67
|
+
t.url = xml.at(:url).inner_html
|
68
|
+
t
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def initialize(name)
|
73
|
+
raise ArgumentError, "Name is required" if name.blank?
|
74
|
+
@name = name
|
75
|
+
end
|
76
|
+
|
77
|
+
def api_path
|
78
|
+
"/#{API_VERSION}/tag/#{CGI::escape(name)}"
|
79
|
+
end
|
80
|
+
|
81
|
+
def top_artists(force=false)
|
82
|
+
get_instance2('tag.gettopartists', :top_artists, :artist, {'tag'=>@name}, force)
|
83
|
+
end
|
84
|
+
|
85
|
+
def top_albums(force=false)
|
86
|
+
get_instance2('tag.gettopalbums', :top_albums, :album, {'tag'=>@name}, force)
|
87
|
+
end
|
88
|
+
|
89
|
+
def top_tracks(force=false)
|
90
|
+
get_instance2('tag.gettoptracks', :top_tracks, :track, {'tag'=>@name}, force)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Below is an example of how to get the top fans for a track.
|
2
|
+
#
|
3
|
+
# track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats')
|
4
|
+
# puts 'Fans'
|
5
|
+
# puts "=" * 4
|
6
|
+
# track.fans.each { |u| puts u.username }
|
7
|
+
#
|
8
|
+
# Which would output something like:
|
9
|
+
#
|
10
|
+
# track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats')
|
11
|
+
# puts 'Fans'
|
12
|
+
# puts "=" * 4
|
13
|
+
# track.fans.each { |u| puts "(#{u.weight}) #{u.username}" }
|
14
|
+
#
|
15
|
+
# Fans
|
16
|
+
# ====
|
17
|
+
# (69163) PimpinRose
|
18
|
+
# (7225) selene204
|
19
|
+
# (7000) CelestiaLegends
|
20
|
+
# (6817) muehllr
|
21
|
+
# (5387) Mudley
|
22
|
+
# (5368) ilovejohnny1984
|
23
|
+
# (5232) MeganIAD
|
24
|
+
# (5132) Veric
|
25
|
+
# (5097) aeVnar
|
26
|
+
# (3390) kristaaan
|
27
|
+
# (3239) kelseaowns
|
28
|
+
# (2780) syndication
|
29
|
+
# (2735) mkumm
|
30
|
+
# (2706) Kimmybeebee
|
31
|
+
# (2648) skorpcroze
|
32
|
+
# (2549) mistergreg
|
33
|
+
# (2449) mlmjcace
|
34
|
+
# (2302) tiNEey
|
35
|
+
# (2169) ajsbabiegirl
|
36
|
+
module Scrobbler
|
37
|
+
class Track < Base
|
38
|
+
attr_accessor :artist, :artist_mbid, :name, :mbid, :playcount, :rank, :url, :reach
|
39
|
+
attr_accessor :streamable, :album, :album_mbid, :date, :date_uts, :now_playing
|
40
|
+
|
41
|
+
# only seems to be used on top tracks for tag
|
42
|
+
attr_accessor :count, :thumbnail, :image
|
43
|
+
|
44
|
+
# for weekly top tracks
|
45
|
+
attr_accessor :chartposition
|
46
|
+
|
47
|
+
class << self
|
48
|
+
def new_from_xml(xml, doc=nil)
|
49
|
+
artist = xml.at('/artist/name').inner_html if xml.at('/artist/name')
|
50
|
+
artist = xml.at(:artist).inner_html if artist.nil? && xml.at(:artist)
|
51
|
+
name = xml.at(:name).inner_html if xml.at(:name)
|
52
|
+
t = Track.new(artist, name)
|
53
|
+
t.artist_mbid = xml.at(:artist)['mbid'] if xml.at(:artist) && xml.at(:artist)['mbid']
|
54
|
+
t.artist_mbid = xml.at('/artist/mbid').inner_html if t.artist_mbid.nil? && xml.at('/artist/mbid')
|
55
|
+
t.mbid = xml.at(:mbid).inner_html if xml.at(:mbid)
|
56
|
+
t.playcount = xml.at(:playcount).inner_html if xml.at(:playcount)
|
57
|
+
t.chartposition = xml.at(:chartposition).inner_html if xml.at(:chartposition)
|
58
|
+
t.rank = xml['rank'] if xml['rank']
|
59
|
+
t.url = xml.at('/url').inner_html if xml.at('/url')
|
60
|
+
t.streamable = xml.at('/streamable').inner_html if xml.at('/streamable')
|
61
|
+
t.count = xml.at('/tagcount').inner_html if xml.at('/tagcount')
|
62
|
+
t.album = xml.at(:album).inner_html if xml.at(:album)
|
63
|
+
t.album_mbid = xml.at(:album)['mbid'] if xml.at(:album) && xml.at(:album)['mbid']
|
64
|
+
t.date = Time.parse((xml).at(:date).inner_html) if xml.at(:date)
|
65
|
+
t.date_uts = xml.at(:date)['uts'] if xml.at(:date) && xml.at(:date)['uts']
|
66
|
+
t.thumbnail = xml.at('/image[@size="small"]').inner_html if xml.at('/image[@size="small"]')
|
67
|
+
t.image = xml.at('/image[@size="medium"]').inner_html if xml.at('/image[@size="medium"]')
|
68
|
+
t.now_playing = true if xml['nowplaying'] && xml['nowplaying'] == 'true'
|
69
|
+
t.now_playing = false unless t.now_playing
|
70
|
+
t
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize(artist, name)
|
75
|
+
raise ArgumentError, "Artist is required" if artist.blank?
|
76
|
+
raise ArgumentError, "Name is required" if name.blank?
|
77
|
+
@artist = artist
|
78
|
+
@name = name
|
79
|
+
end
|
80
|
+
|
81
|
+
def fans(force=false)
|
82
|
+
get_instance2('track.gettopfans', :fans, :user, {'artist'=>@artist, 'track'=>@name}, force)
|
83
|
+
end
|
84
|
+
|
85
|
+
def tags(force=false)
|
86
|
+
get_instance2('track.gettoptags', :tags, :tag, {'artist'=>@artist, 'track'=>@name}, force)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# Probably the most common use of this lib would be to get your most recent tracks or your top tracks. Below are some code samples.
|
2
|
+
# user = Scrobbler::User.new('jnunemaker')
|
3
|
+
#
|
4
|
+
# puts "#{user.username}'s Recent Tracks"
|
5
|
+
# puts "=" * (user.username.length + 16)
|
6
|
+
# user.recent_tracks.each { |t| puts t.name }
|
7
|
+
#
|
8
|
+
# puts
|
9
|
+
# puts
|
10
|
+
#
|
11
|
+
# puts "#{user.username}'s Top Tracks"
|
12
|
+
# puts "=" * (user.username.length + 13)
|
13
|
+
# user.top_tracks.each { |t| puts "(#{t.playcount}) #{t.name}" }
|
14
|
+
#
|
15
|
+
# Which would output something like:
|
16
|
+
#
|
17
|
+
# jnunemaker's Recent Tracks
|
18
|
+
# ==========================
|
19
|
+
# Everything You Want
|
20
|
+
# You're a God
|
21
|
+
# Bitter Sweet Symphony [Original Version]
|
22
|
+
# Lord I Guess I'll Never Know
|
23
|
+
# Country Song
|
24
|
+
# Bitter Sweet Symphony (Radio Edit)
|
25
|
+
#
|
26
|
+
#
|
27
|
+
# jnunemaker's Top Tracks
|
28
|
+
# =======================
|
29
|
+
# (62) Probably Wouldn't Be This Way
|
30
|
+
# (55) Not Ready To Make Nice
|
31
|
+
# (45) Easy Silence
|
32
|
+
# (43) Song 2
|
33
|
+
# (40) Everybody Knows
|
34
|
+
# (39) Before He Cheats
|
35
|
+
# (39) Something's Gotta Give
|
36
|
+
# (38) Hips Don't Lie (featuring Wyclef Jean)
|
37
|
+
# (37) Unwritten
|
38
|
+
# (37) Move Along
|
39
|
+
# (37) Dance, Dance
|
40
|
+
# (36) We Belong Together
|
41
|
+
# (36) Jesus, Take the Wheel
|
42
|
+
# (36) Black Horse and the Cherry Tree (radio version)
|
43
|
+
# (35) Photograph
|
44
|
+
# (35) You're Beautiful
|
45
|
+
# (35) Walk Away
|
46
|
+
# (34) Stickwitu
|
47
|
+
module Scrobbler
|
48
|
+
class User < Base
|
49
|
+
# attributes needed to initialize
|
50
|
+
attr_reader :username
|
51
|
+
|
52
|
+
# profile attributes
|
53
|
+
attr_accessor :id, :cluster, :url, :realname, :mbox_sha1sum, :registered
|
54
|
+
attr_accessor :registered_unixtime, :age, :gender, :country, :playcount, :avatar
|
55
|
+
|
56
|
+
# neighbor attributes
|
57
|
+
attr_accessor :match
|
58
|
+
|
59
|
+
# track fans attributes
|
60
|
+
attr_accessor :weight
|
61
|
+
|
62
|
+
class << self
|
63
|
+
def new_from_xml(xml, doc=nil)
|
64
|
+
u = User.new(xml.at(:name).inner_html)
|
65
|
+
u.url = (xml).at(:url).inner_html if (xml).at(:url)
|
66
|
+
u.avatar = (xml).at(:image).inner_html if (xml).at(:image)
|
67
|
+
u.weight = (xml).at(:weight).inner_html if (xml).at(:weight)
|
68
|
+
u.match = (xml).at(:match).inner_html if (xml).at(:match)
|
69
|
+
u
|
70
|
+
end
|
71
|
+
|
72
|
+
def find(*args)
|
73
|
+
options = {:include_profile => false}
|
74
|
+
options.merge!(args.pop) if args.last.is_a?(Hash)
|
75
|
+
users = args.flatten.inject([]) { |users, u| users << User.new(u, options); users }
|
76
|
+
users.length == 1 ? users.pop : users
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def initialize(username, o={})
|
81
|
+
options = {:include_profile => false}.merge(o)
|
82
|
+
raise ArgumentError if username.blank?
|
83
|
+
@username = username
|
84
|
+
load_profile() if options[:include_profile]
|
85
|
+
end
|
86
|
+
|
87
|
+
def api_path
|
88
|
+
"/#{API_VERSION}/user/#{CGI::escape(username)}"
|
89
|
+
end
|
90
|
+
|
91
|
+
def current_events(format=:ics)
|
92
|
+
format = :ics if format.to_s == 'ical'
|
93
|
+
raise ArgumentError unless ['ics', 'rss'].include?(format.to_s)
|
94
|
+
"#{API_URL.chop}#{api_path}/events.#{format}"
|
95
|
+
end
|
96
|
+
|
97
|
+
def friends_events(format=:ics)
|
98
|
+
format = :ics if format.to_s == 'ical'
|
99
|
+
raise ArgumentError unless ['ics', 'rss'].include?(format.to_s)
|
100
|
+
"#{API_URL.chop}#{api_path}/friendevents.#{format}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def recommended_events(format=:ics)
|
104
|
+
format = :ics if format.to_s == 'ical'
|
105
|
+
raise ArgumentError unless ['ics', 'rss'].include?(format.to_s)
|
106
|
+
"#{API_URL.chop}#{api_path}/eventsysrecs.#{format}"
|
107
|
+
end
|
108
|
+
|
109
|
+
def load_profile
|
110
|
+
doc = self.class.fetch_and_parse("#{api_path}/profile.xml")
|
111
|
+
@id = (doc).at(:profile)['id']
|
112
|
+
@cluster = (doc).at(:profile)['cluster']
|
113
|
+
@url = (doc).at(:url).inner_html
|
114
|
+
@realname = (doc).at(:realname).inner_html
|
115
|
+
@mbox_sha1sum = (doc).at(:mbox_sha1sum).inner_html
|
116
|
+
@registered = (doc).at(:registered).inner_html
|
117
|
+
@registered_unixtime = (doc).at(:registered)['unixtime']
|
118
|
+
@age = (doc).at(:age).inner_html
|
119
|
+
@gender = (doc).at(:gender).inner_html
|
120
|
+
@country = (doc).at(:country).inner_html
|
121
|
+
@playcount = (doc).at(:playcount).inner_html
|
122
|
+
@avatar = (doc).at(:avatar).inner_html
|
123
|
+
end
|
124
|
+
|
125
|
+
def top_artists(force=false, period='overall')
|
126
|
+
get_instance2('user.gettopartists', :top_artists, :artist, {'user'=>@username, 'period'=>period}, force)
|
127
|
+
end
|
128
|
+
|
129
|
+
def top_albums(force=false, period='overall')
|
130
|
+
get_instance2('user.gettopalbums', :top_albums, :album, {'user'=>@username, 'period'=>period}, force)
|
131
|
+
end
|
132
|
+
|
133
|
+
def top_tracks(force=false, period='overall')
|
134
|
+
get_instance2('user.gettoptracks', :top_tracks, :track, {'user'=>@username, 'period'=>period}, force)
|
135
|
+
end
|
136
|
+
|
137
|
+
def top_tags(force=false)
|
138
|
+
get_instance2('user.gettoptags', :top_tags, :tag, {'user'=>@username}, force)
|
139
|
+
end
|
140
|
+
|
141
|
+
def friends(force=false, page=1, limit=50)
|
142
|
+
get_instance2('user.getfriends', :friends, :user, {'user'=>@username, 'page'=>page.to_s, 'limit'=>limit.to_s}, force)
|
143
|
+
end
|
144
|
+
|
145
|
+
def neighbours(force=false)
|
146
|
+
get_instance2('user.getneighbours', :neighbours, :user, {'user'=>@username}, force)
|
147
|
+
end
|
148
|
+
|
149
|
+
def recent_tracks(force=false)
|
150
|
+
get_instance2('user.getrecenttracks', :recent_tracks, :track, {'user'=>@username}, force)
|
151
|
+
end
|
152
|
+
|
153
|
+
def recent_banned_tracks(force=false)
|
154
|
+
#warn "#{file}:#{lineno}:Warning: Scrobbler::User#recent_banned_tracks is deprecated (not supported by the Last.fm 2.0 API)"
|
155
|
+
get_instance(:recentbannedtracks, :recent_banned_tracks, :track, force)
|
156
|
+
end
|
157
|
+
|
158
|
+
def recent_loved_tracks(force=false)
|
159
|
+
#warn "#{file}:#{lineno}:Warning: Scrobbler::User#recent_loved_tracks is deprecated (not supported by the Last.fm 2.0 API)"
|
160
|
+
get_instance(:recentlovedtracks, :recent_loved_tracks, :track, force)
|
161
|
+
end
|
162
|
+
|
163
|
+
def recommendations(force=false)
|
164
|
+
#warn "#{file}:#{lineno}:Warning: Scrobbler::User#recommendations is deprecated (not supported by the Last.fm 2.0 API)"
|
165
|
+
get_instance(:systemrecs, :recommendations, :artist, force)
|
166
|
+
end
|
167
|
+
|
168
|
+
def charts(force=false)
|
169
|
+
get_instance2('user.getweeklychartlist', :charts, :chart, {'user'=>@username}, force)
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
data/scrobbler.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{scrobbler}
|
5
|
+
s.version = "0.2.14"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["John Nunemaker, Jonathan Rudenberg, Uwe L. Korn"]
|
9
|
+
s.date = %q{2009-05-02}
|
10
|
+
s.description = %q{wrapper for audioscrobbler (last.fm) web services}
|
11
|
+
s.email = %q{nunemaker@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["lib/scrobbler/search.rb", "lib/scrobbler/rest.rb", "lib/scrobbler/track.rb", "lib/scrobbler/simpleauth.rb", "lib/scrobbler/base.rb", "lib/scrobbler/version.rb", "lib/scrobbler/chart.rb", "lib/scrobbler/playing.rb", "lib/scrobbler/artist.rb", "lib/scrobbler/scrobble.rb", "lib/scrobbler/user.rb", "lib/scrobbler/album.rb", "lib/scrobbler/tag.rb", "lib/scrobbler.rb", "README.rdoc"]
|
13
|
+
s.files = ["lib/scrobbler/search.rb", "lib/scrobbler/rest.rb", "lib/scrobbler/track.rb", "lib/scrobbler/simpleauth.rb", "lib/scrobbler/base.rb", "lib/scrobbler/version.rb", "lib/scrobbler/chart.rb", "lib/scrobbler/playing.rb", "lib/scrobbler/artist.rb", "lib/scrobbler/scrobble.rb", "lib/scrobbler/user.rb", "lib/scrobbler/album.rb", "lib/scrobbler/tag.rb", "lib/scrobbler.rb", "scrobbler.gemspec", "MIT-LICENSE", "Rakefile", "History.txt", "setup.rb", "README.rdoc", "examples/track.rb", "examples/artist.rb", "examples/scrobble.rb", "examples/user.rb", "examples/album.rb", "examples/tag.rb", "test/unit/album_test.rb", "test/unit/playing_test.rb", "test/unit/scrobble_test.rb", "test/unit/artist_test.rb", "test/unit/chart_test.rb", "test/unit/track_test.rb", "test/unit/tag_test.rb", "test/unit/search_test.rb", "test/unit/simpleauth_test.rb", "test/unit/user_test.rb", "test/test_helper.rb", "test/mocks/rest.rb", "test/fixtures/xml/album/info.xml", "test/fixtures/xml/track/toptags.xml", "test/fixtures/xml/track/fans.xml", "test/fixtures/xml/artist/toptags.xml", "test/fixtures/xml/artist/similar.xml", "test/fixtures/xml/artist/topalbums.xml", "test/fixtures/xml/artist/toptracks.xml", "test/fixtures/xml/artist/fans.xml", "test/fixtures/xml/tag/toptags.xml", "test/fixtures/xml/tag/topalbums.xml", "test/fixtures/xml/tag/toptracks.xml", "test/fixtures/xml/tag/topartists.xml", "test/fixtures/xml/search/track.xml", "test/fixtures/xml/search/artist.xml", "test/fixtures/xml/search/album.xml", "test/fixtures/xml/user/toptags.xml", "test/fixtures/xml/user/recentbannedtracks.xml", "test/fixtures/xml/user/topalbums.xml", "test/fixtures/xml/user/toptracks.xml", "test/fixtures/xml/user/recentlovedtracks.xml", "test/fixtures/xml/user/recenttracks.xml", "test/fixtures/xml/user/friends.xml", "test/fixtures/xml/user/profile.xml", "test/fixtures/xml/user/topartists.xml", "test/fixtures/xml/user/systemrecs.xml", "test/fixtures/xml/user/neighbours.xml", "Manifest"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://scrobbler.rubyforge.org}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Scrobbler", "--main", "README.rdoc"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{scrobbler}
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{wrapper for audioscrobbler (last.fm) web services}
|
21
|
+
s.test_files = ["test/unit/album_test.rb", "test/unit/playing_test.rb", "test/unit/scrobble_test.rb", "test/unit/artist_test.rb", "test/unit/chart_test.rb", "test/unit/track_test.rb", "test/unit/tag_test.rb", "test/unit/search_test.rb", "test/unit/simpleauth_test.rb", "test/unit/user_test.rb", "test/test_helper.rb"]
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 2
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<hpricot>, [">= 0.4.86"])
|
29
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 1.4.2"])
|
30
|
+
s.add_runtime_dependency(%q<htmlentities>, [">= 4.0.0"])
|
31
|
+
else
|
32
|
+
s.add_dependency(%q<hpricot>, [">= 0.4.86"])
|
33
|
+
s.add_dependency(%q<activesupport>, [">= 1.4.2"])
|
34
|
+
s.add_dependency(%q<htmlentities>, [">= 4.0.0"])
|
35
|
+
end
|
36
|
+
else
|
37
|
+
s.add_dependency(%q<hpricot>, [">= 0.4.86"])
|
38
|
+
s.add_dependency(%q<activesupport>, [">= 1.4.2"])
|
39
|
+
s.add_dependency(%q<htmlentities>, [">= 4.0.0"])
|
40
|
+
end
|
41
|
+
end
|