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,55 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class TestSearch < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@artist_name = "Radiohead"
|
7
|
+
@album_name = "Amnesiac"
|
8
|
+
@track_name = "Knives Out"
|
9
|
+
@api_key = "122345678"
|
10
|
+
@search = Scrobbler::Search.new(@api_key)
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'should be able to search for an album and return a list of possible matches' do
|
14
|
+
assert_equal(20, @search.by_album(@album_name).size)
|
15
|
+
end
|
16
|
+
|
17
|
+
test "should be able to correctly find the album that we're searching for" do
|
18
|
+
assert_equal("Make Believe", @search.by_album(@album_name)[0].name)
|
19
|
+
end
|
20
|
+
|
21
|
+
test "should be able to search for an artist and return a list of possible matches" do
|
22
|
+
assert_equal(20, @search.by_artist(@artist_name).size)
|
23
|
+
end
|
24
|
+
|
25
|
+
test "should be able to correctly find the artist that we're searching for" do
|
26
|
+
assert_equal("Radiohead", @search.by_artist(@artist_name)[0].name)
|
27
|
+
end
|
28
|
+
|
29
|
+
test "should be able to search for a track and return a list of possible matches" do
|
30
|
+
assert_equal(20, @search.by_track(@track_name).size)
|
31
|
+
end
|
32
|
+
|
33
|
+
test "should be able to correctly find the track that we're searching for" do
|
34
|
+
assert_equal("Knives Out", @search.by_track(@track_name)[0].name)
|
35
|
+
end
|
36
|
+
|
37
|
+
test "should have correct api path when searching for an album" do
|
38
|
+
@search.type = 'album'
|
39
|
+
@search.query = @album_name
|
40
|
+
assert_equal("/2.0/?method=album.search&album=#{@album_name}&api_key=#{@api_key}", @search.api_path)
|
41
|
+
end
|
42
|
+
|
43
|
+
test "should have correct api path when searching for an artist" do
|
44
|
+
@search.type = 'artist'
|
45
|
+
@search.query = @artist_name
|
46
|
+
assert_equal("/2.0/?method=artist.search&artist=#{@artist_name}&api_key=#{@api_key}", @search.api_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
test "should have correct api path when searching for a track" do
|
50
|
+
@search.type = 'track'
|
51
|
+
@search.query = @track_name
|
52
|
+
assert_equal("/2.0/?method=track.search&track=#{CGI::escape(@track_name)}&api_key=#{@api_key}", @search.api_path)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class TestSimpleAuth < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@auth = Scrobbler::SimpleAuth.new(:user => 'chunky', :password => 'bacon')
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should require a user' do
|
10
|
+
assert_raises(ArgumentError) { Scrobbler::SimpleAuth.new(:password => 'bacon') }
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'should require a password' do
|
14
|
+
assert_raises(ArgumentError) { Scrobbler::SimpleAuth.new(:user => 'chunky') }
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'should have the right client id' do
|
18
|
+
assert_equal('rbs', @auth.client_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'should have the right version' do
|
22
|
+
assert_equal(Scrobbler::Version, @auth.client_ver)
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'should handshake successfully' do
|
26
|
+
@auth.handshake!
|
27
|
+
assert_equal('OK', @auth.status)
|
28
|
+
end
|
29
|
+
|
30
|
+
test 'should get a session id' do
|
31
|
+
@auth.handshake!
|
32
|
+
assert_equal('17E61E13454CDD8B68E8D7DEEEDF6170', @auth.session_id)
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'should get a now playing url' do
|
36
|
+
@auth.handshake!
|
37
|
+
assert_equal('http://62.216.251.203:80/nowplaying', @auth.now_playing_url)
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'should get a submission url' do
|
41
|
+
@auth.handshake!
|
42
|
+
assert_equal('http://62.216.251.205:80/protocol_1.2', @auth.submission_url)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class TestTag < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@tag = Scrobbler::Tag.new('rock')
|
6
|
+
end
|
7
|
+
|
8
|
+
test 'should require name' do
|
9
|
+
assert_raise(ArgumentError) { Scrobbler::Tag.new('') }
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'should have name' do
|
13
|
+
assert_equal('rock', @tag.name)
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'should have api path' do
|
17
|
+
assert_equal('/1.0/tag/rock', @tag.api_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'should escape api path' do
|
21
|
+
assert_equal('/1.0/tag/rock+and+roll', Scrobbler::Tag.new('rock and roll').api_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'should be able to find top artists for a tag' do
|
25
|
+
assert_equal(50, @tag.top_artists.size)
|
26
|
+
assert_equal('ABBA', @tag.top_artists.first.name)
|
27
|
+
assert_equal('1229', @tag.top_artists.first.count)
|
28
|
+
assert_equal('yes', @tag.top_artists.first.streamable)
|
29
|
+
assert_equal('d87e52c5-bb8d-4da8-b941-9f4928627dc8', @tag.top_artists.first.mbid)
|
30
|
+
assert_equal('http://www.last.fm/music/ABBA', @tag.top_artists.first.url)
|
31
|
+
assert_equal('http://userserve-ak.last.fm/serve/34/135930.jpg', @tag.top_artists.first.image(:small))
|
32
|
+
assert_equal('http://userserve-ak.last.fm/serve/64/135930.jpg', @tag.top_artists.first.image(:medium))
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'should be able to find top albums for a tag' do
|
36
|
+
assert_equal(50, @tag.top_albums.size)
|
37
|
+
assert_equal('Overpowered', @tag.top_albums.first.name)
|
38
|
+
assert_equal('Róisín Murphy', @tag.top_albums.first.artist)
|
39
|
+
assert_equal('4c56405d-ba8e-4283-99c3-1dc95bdd50e7', @tag.top_albums.first.artist_mbid)
|
40
|
+
assert_equal('http://www.last.fm/music/R%C3%B3is%C3%ADn+Murphy/Overpowered', @tag.top_albums.first.url)
|
41
|
+
assert_equal('http://userserve-ak.last.fm/serve/34s/26856969.png', @tag.top_albums.first.image(:small))
|
42
|
+
assert_equal('http://userserve-ak.last.fm/serve/64s/26856969.png', @tag.top_albums.first.image(:medium))
|
43
|
+
assert_equal('http://userserve-ak.last.fm/serve/126/26856969.png', @tag.top_albums.first.image(:large))
|
44
|
+
end
|
45
|
+
|
46
|
+
test 'should be able to find top tracks for a tag' do
|
47
|
+
assert_equal(50, @tag.top_tracks.size)
|
48
|
+
first = @tag.top_tracks.first
|
49
|
+
assert_equal('Stayin\' Alive', first.name)
|
50
|
+
assert_equal('422', first.count)
|
51
|
+
assert_equal('1', first.streamable)
|
52
|
+
assert_equal('Bee Gees', first.artist)
|
53
|
+
assert_equal('bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810', first.artist_mbid)
|
54
|
+
assert_equal('http://www.last.fm/music/Bee+Gees/_/Stayin%27+Alive', first.url)
|
55
|
+
assert_equal('http://images.amazon.com/images/P/B00069590Q.01._SCMZZZZZZZ_.jpg', first.thumbnail)
|
56
|
+
assert_equal('http://images.amazon.com/images/P/B00069590Q.01._SCMZZZZZZZ_.jpg', first.image)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class TestTrack < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats')
|
6
|
+
end
|
7
|
+
|
8
|
+
test 'should require the artist name' do
|
9
|
+
assert_raises(ArgumentError) { Scrobbler::Track.new('', 'Before He Cheats') }
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'should require the track name' do
|
13
|
+
assert_raises(ArgumentError) { Scrobbler::Track.new('Carrie Underwood', '') }
|
14
|
+
end
|
15
|
+
|
16
|
+
test "should know the artist" do
|
17
|
+
assert_equal('Carrie Underwood', @track.artist)
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'should know the name' do
|
21
|
+
assert_equal('Before He Cheats', @track.name)
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'should have fans' do
|
25
|
+
assert_equal(3, @track.fans.size)
|
26
|
+
assert_equal('ccaron0', @track.fans.first.username)
|
27
|
+
assert_equal('http://www.last.fm/user/ccaron0', @track.fans.first.url)
|
28
|
+
assert_equal('335873', @track.fans.first.weight)
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'should have top tags' do
|
32
|
+
assert_equal(6, @track.tags.size)
|
33
|
+
assert_equal('country', @track.tags.first.name)
|
34
|
+
assert_equal('100', @track.tags.first.count)
|
35
|
+
assert_equal('http://www.last.fm/tag/country', @track.tags.first.url)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class TestUser < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@user = Scrobbler::User.new('jnunemaker')
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should be able to find one user' do
|
10
|
+
assert_equal(@user.username, Scrobbler::User.find('jnunemaker').username)
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'should be able to find multiple users' do
|
14
|
+
users = Scrobbler::User.find('jnunemaker', 'oaknd1', 'wharle')
|
15
|
+
assert_equal(%w{jnunemaker oaknd1 wharle}, users.collect(&:username))
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'should be able to find multiple users using an array' do
|
19
|
+
users = Scrobbler::User.find(%w{jnunemaker oaknd1 wharle})
|
20
|
+
assert_equal(%w{jnunemaker oaknd1 wharle}, users.collect(&:username))
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'should require a username' do
|
24
|
+
assert_raise(ArgumentError) { Scrobbler::User.new('') }
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'should have api path' do
|
28
|
+
assert_equal('/1.0/user/jnunemaker', @user.api_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'should know the correct current events addresses' do
|
32
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/events.ics', @user.current_events(:ical))
|
33
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/events.ics', @user.current_events(:ics))
|
34
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/events.rss', @user.current_events(:rss))
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'should know the correct friends events addresses' do
|
38
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/friendevents.ics', @user.friends_events(:ical))
|
39
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/friendevents.ics', @user.friends_events(:ics))
|
40
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/friendevents.rss', @user.friends_events(:rss))
|
41
|
+
end
|
42
|
+
|
43
|
+
test 'should know the correct recommended events addresses' do
|
44
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/eventsysrecs.ics', @user.recommended_events(:ical))
|
45
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/eventsysrecs.ics', @user.recommended_events(:ics))
|
46
|
+
assert_equal('http://ws.audioscrobbler.com/1.0/user/jnunemaker/eventsysrecs.rss', @user.recommended_events(:rss))
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'should be able to include profile during initialization' do
|
50
|
+
user = Scrobbler::User.new('jnunemaker', :include_profile => true)
|
51
|
+
assert_equal('3017870', user.id)
|
52
|
+
assert_equal('4', user.cluster)
|
53
|
+
assert_equal('http://www.last.fm/user/jnunemaker/', user.url)
|
54
|
+
assert_equal('John Nunemaker', user.realname)
|
55
|
+
assert_equal('d5bbe280b7a41d4a87253361692ef105b983cf1a', user.mbox_sha1sum)
|
56
|
+
assert_equal('Dec 8, 2005', user.registered)
|
57
|
+
assert_equal('1134050307', user.registered_unixtime)
|
58
|
+
assert_equal('25', user.age)
|
59
|
+
assert_equal('m', user.gender)
|
60
|
+
assert_equal('United States', user.country)
|
61
|
+
assert_equal('13267', user.playcount)
|
62
|
+
assert_equal('http://panther1.last.fm/avatar/5cb420de0855dadf6bcb1090d8ff02bb.jpg', user.avatar)
|
63
|
+
end
|
64
|
+
|
65
|
+
test 'should be able to load users profile' do
|
66
|
+
@user.load_profile
|
67
|
+
assert_equal('3017870', @user.id)
|
68
|
+
assert_equal('4', @user.cluster)
|
69
|
+
assert_equal('http://www.last.fm/user/jnunemaker/', @user.url)
|
70
|
+
assert_equal('John Nunemaker', @user.realname)
|
71
|
+
assert_equal('d5bbe280b7a41d4a87253361692ef105b983cf1a', @user.mbox_sha1sum)
|
72
|
+
assert_equal('Dec 8, 2005', @user.registered)
|
73
|
+
assert_equal('1134050307', @user.registered_unixtime)
|
74
|
+
assert_equal('25', @user.age)
|
75
|
+
assert_equal('m', @user.gender)
|
76
|
+
assert_equal('United States', @user.country)
|
77
|
+
assert_equal('13267', @user.playcount)
|
78
|
+
assert_equal('http://panther1.last.fm/avatar/5cb420de0855dadf6bcb1090d8ff02bb.jpg', @user.avatar)
|
79
|
+
end
|
80
|
+
|
81
|
+
test "should be able to get a user's top artists" do
|
82
|
+
assert_equal(3, @user.top_artists.size)
|
83
|
+
first = @user.top_artists.first
|
84
|
+
assert_equal('Dream Theater', first.name)
|
85
|
+
assert_equal('28503ab7-8bf2-4666-a7bd-2644bfc7cb1d', first.mbid)
|
86
|
+
assert_equal('1643', first.playcount)
|
87
|
+
assert_equal('1', first.rank)
|
88
|
+
assert_equal('http://www.last.fm/music/Dream+Theater', first.url)
|
89
|
+
assert_equal('http://userserve-ak.last.fm/serve/34/5535004.jpg', first.image(:small))
|
90
|
+
assert_equal('http://userserve-ak.last.fm/serve/64/5535004.jpg', first.image(:medium))
|
91
|
+
assert_equal('http://userserve-ak.last.fm/serve/126/5535004.jpg', first.image(:large))
|
92
|
+
end
|
93
|
+
|
94
|
+
test 'should be able to get top albums' do
|
95
|
+
assert_equal(3, @user.top_albums.size)
|
96
|
+
first = @user.top_albums.first
|
97
|
+
assert_equal('Skid Row', first.artist)
|
98
|
+
assert_equal('6da0515e-a27d-449d-84cc-00713c38a140', first.artist_mbid)
|
99
|
+
assert_equal('Slave To The Grid', first.name)
|
100
|
+
assert_equal('251', first.playcount)
|
101
|
+
assert_equal('1', first.rank)
|
102
|
+
assert_equal('http://www.last.fm/music/Skid+Row/Slave+To+The+Grid', first.url)
|
103
|
+
assert_equal('http://userserve-ak.last.fm/serve/34s/12621887.jpg', first.image(:small))
|
104
|
+
assert_equal('http://userserve-ak.last.fm/serve/64s/12621887.jpg', first.image(:medium))
|
105
|
+
assert_equal('http://userserve-ak.last.fm/serve/126/12621887.jpg', first.image(:large))
|
106
|
+
end
|
107
|
+
|
108
|
+
test 'should be able to get top tracks' do
|
109
|
+
assert_equal(3, @user.top_tracks.size)
|
110
|
+
first = @user.top_tracks.first
|
111
|
+
assert_equal("Learning to Live", first.name)
|
112
|
+
assert_equal('Dream Theater', first.artist)
|
113
|
+
assert_equal('28503ab7-8bf2-4666-a7bd-2644bfc7cb1d', first.artist_mbid)
|
114
|
+
assert_equal("", first.mbid)
|
115
|
+
assert_equal('51', first.playcount)
|
116
|
+
assert_equal('1', first.rank)
|
117
|
+
assert_equal('http://www.last.fm/music/Dream+Theater/_/Learning+to+Live', first.url)
|
118
|
+
end
|
119
|
+
|
120
|
+
test 'should be able to get top tags' do
|
121
|
+
assert_equal(7, @user.top_tags.size)
|
122
|
+
first = @user.top_tags.first
|
123
|
+
assert_equal("rock", first.name)
|
124
|
+
assert_equal("16", first.count)
|
125
|
+
assert_equal("www.last.fm/tag/rock", first.url)
|
126
|
+
end
|
127
|
+
|
128
|
+
# not implemented
|
129
|
+
test 'should be able to get top tags for artist' do
|
130
|
+
end
|
131
|
+
# not implemented
|
132
|
+
test 'should be able to get top tags for album' do
|
133
|
+
end
|
134
|
+
# not implemented
|
135
|
+
test 'should be able to get top tags for track' do
|
136
|
+
end
|
137
|
+
|
138
|
+
test 'should have friends' do
|
139
|
+
assert_equal(3, @user.friends.size)
|
140
|
+
first = @user.friends.first
|
141
|
+
assert_equal('lobsterclaw', first.username)
|
142
|
+
assert_equal('http://www.last.fm/user/lobsterclaw', first.url)
|
143
|
+
assert_equal('http://userserve-ak.last.fm/serve/34/1733471.jpg', first.avatar)
|
144
|
+
end
|
145
|
+
|
146
|
+
test 'should have neighbours' do
|
147
|
+
assert_equal(2, @user.neighbours.size)
|
148
|
+
first = @user.neighbours.first
|
149
|
+
assert_equal('Driotheri', first.username)
|
150
|
+
assert_equal('http://www.last.fm/user/Driotheri', first.url)
|
151
|
+
assert_equal('http://userserve-ak.last.fm/serve/34/6070771.jpg', first.avatar)
|
152
|
+
end
|
153
|
+
|
154
|
+
test 'should have recent tracks' do
|
155
|
+
assert_equal(3, @user.recent_tracks.size)
|
156
|
+
first = @user.recent_tracks.first
|
157
|
+
assert_equal('Liquid Dreams', first.name)
|
158
|
+
assert_equal('Liquid Tension Experiment', first.artist)
|
159
|
+
assert_equal('bc641be9-ca36-4c61-9394-5230433f6646', first.artist_mbid)
|
160
|
+
assert_equal('', first.mbid)
|
161
|
+
assert_equal('6c20d297-121e-47d0-aa3a-8f27c7a06553', first.album_mbid)
|
162
|
+
assert_equal('Liquid Tension Experiment 2', first.album)
|
163
|
+
assert_equal('http://www.last.fm/music/Liquid+Tension+Experiment/_/Liquid+Dreams', first.url)
|
164
|
+
assert_equal(Time.mktime(2009, 4, 28, 17, 54, 00), first.date)
|
165
|
+
assert_equal('1240941262', first.date_uts)
|
166
|
+
assert_equal(true, first.now_playing)
|
167
|
+
end
|
168
|
+
|
169
|
+
test 'should have recent banned tracks' do
|
170
|
+
assert_equal(3, @user.recent_banned_tracks.size)
|
171
|
+
first = @user.recent_banned_tracks.first
|
172
|
+
assert_equal('Dress Rehearsal Rag', first.name)
|
173
|
+
assert_equal('Leonard Cohen', first.artist)
|
174
|
+
assert_equal('65314b12-0e08-43fa-ba33-baaa7b874c15', first.artist_mbid)
|
175
|
+
assert_equal('', first.mbid)
|
176
|
+
assert_equal('http://www.last.fm/music/Leonard+Cohen/_/Dress+Rehearsal+Rag', first.url)
|
177
|
+
assert_equal(Time.mktime(2006, 9, 27, 14, 19, 00), first.date)
|
178
|
+
assert_equal('1159366744', first.date_uts)
|
179
|
+
end
|
180
|
+
|
181
|
+
test 'should have recent loved tracks' do
|
182
|
+
assert_equal(3, @user.recent_loved_tracks.size)
|
183
|
+
first = @user.recent_loved_tracks.first
|
184
|
+
assert_equal('Am I Missing', first.name)
|
185
|
+
assert_equal('Dashboard Confessional', first.artist)
|
186
|
+
assert_equal('50549203-9602-451c-b49f-ff031ba8635c', first.artist_mbid)
|
187
|
+
assert_equal('', first.mbid)
|
188
|
+
assert_equal('http://www.last.fm/music/Dashboard+Confessional/_/Am+I+Missing', first.url)
|
189
|
+
assert_equal(Time.mktime(2006, 9, 26, 17, 43, 00), first.date)
|
190
|
+
assert_equal('1159292606', first.date_uts)
|
191
|
+
end
|
192
|
+
|
193
|
+
test 'should have recommendations' do
|
194
|
+
assert_equal(3, @user.recommendations.size)
|
195
|
+
first = @user.recommendations.first
|
196
|
+
assert_equal('Kaiser Chiefs', first.name)
|
197
|
+
assert_equal('90218af4-4d58-4821-8d41-2ee295ebbe21', first.mbid)
|
198
|
+
assert_equal('http://www.last.fm/music/Kaiser+Chiefs', first.url)
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xhochy-scrobbler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.14
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Nunemaker, Jonathan Rudenberg, Uwe L. Korn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-02 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hpricot
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.4.86
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.2
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: htmlentities
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 4.0.0
|
44
|
+
version:
|
45
|
+
description: wrapper for audioscrobbler (last.fm) web services
|
46
|
+
email: nunemaker@gmail.com
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- lib/scrobbler/search.rb
|
53
|
+
- lib/scrobbler/rest.rb
|
54
|
+
- lib/scrobbler/track.rb
|
55
|
+
- lib/scrobbler/simpleauth.rb
|
56
|
+
- lib/scrobbler/base.rb
|
57
|
+
- lib/scrobbler/version.rb
|
58
|
+
- lib/scrobbler/chart.rb
|
59
|
+
- lib/scrobbler/playing.rb
|
60
|
+
- lib/scrobbler/artist.rb
|
61
|
+
- lib/scrobbler/scrobble.rb
|
62
|
+
- lib/scrobbler/user.rb
|
63
|
+
- lib/scrobbler/album.rb
|
64
|
+
- lib/scrobbler/tag.rb
|
65
|
+
- lib/scrobbler.rb
|
66
|
+
- README.rdoc
|
67
|
+
files:
|
68
|
+
- lib/scrobbler/search.rb
|
69
|
+
- lib/scrobbler/rest.rb
|
70
|
+
- lib/scrobbler/track.rb
|
71
|
+
- lib/scrobbler/simpleauth.rb
|
72
|
+
- lib/scrobbler/base.rb
|
73
|
+
- lib/scrobbler/version.rb
|
74
|
+
- lib/scrobbler/chart.rb
|
75
|
+
- lib/scrobbler/playing.rb
|
76
|
+
- lib/scrobbler/artist.rb
|
77
|
+
- lib/scrobbler/scrobble.rb
|
78
|
+
- lib/scrobbler/user.rb
|
79
|
+
- lib/scrobbler/album.rb
|
80
|
+
- lib/scrobbler/tag.rb
|
81
|
+
- lib/scrobbler.rb
|
82
|
+
- scrobbler.gemspec
|
83
|
+
- MIT-LICENSE
|
84
|
+
- Rakefile
|
85
|
+
- History.txt
|
86
|
+
- setup.rb
|
87
|
+
- README.rdoc
|
88
|
+
- examples/track.rb
|
89
|
+
- examples/artist.rb
|
90
|
+
- examples/scrobble.rb
|
91
|
+
- examples/user.rb
|
92
|
+
- examples/album.rb
|
93
|
+
- examples/tag.rb
|
94
|
+
- test/unit/album_test.rb
|
95
|
+
- test/unit/playing_test.rb
|
96
|
+
- test/unit/scrobble_test.rb
|
97
|
+
- test/unit/artist_test.rb
|
98
|
+
- test/unit/chart_test.rb
|
99
|
+
- test/unit/track_test.rb
|
100
|
+
- test/unit/tag_test.rb
|
101
|
+
- test/unit/search_test.rb
|
102
|
+
- test/unit/simpleauth_test.rb
|
103
|
+
- test/unit/user_test.rb
|
104
|
+
- test/test_helper.rb
|
105
|
+
- test/mocks/rest.rb
|
106
|
+
- test/fixtures/xml/album/info.xml
|
107
|
+
- test/fixtures/xml/track/toptags.xml
|
108
|
+
- test/fixtures/xml/track/fans.xml
|
109
|
+
- test/fixtures/xml/artist/toptags.xml
|
110
|
+
- test/fixtures/xml/artist/similar.xml
|
111
|
+
- test/fixtures/xml/artist/topalbums.xml
|
112
|
+
- test/fixtures/xml/artist/toptracks.xml
|
113
|
+
- test/fixtures/xml/artist/fans.xml
|
114
|
+
- test/fixtures/xml/tag/toptags.xml
|
115
|
+
- test/fixtures/xml/tag/topalbums.xml
|
116
|
+
- test/fixtures/xml/tag/toptracks.xml
|
117
|
+
- test/fixtures/xml/tag/topartists.xml
|
118
|
+
- test/fixtures/xml/search/track.xml
|
119
|
+
- test/fixtures/xml/search/artist.xml
|
120
|
+
- test/fixtures/xml/search/album.xml
|
121
|
+
- test/fixtures/xml/user/toptags.xml
|
122
|
+
- test/fixtures/xml/user/recentbannedtracks.xml
|
123
|
+
- test/fixtures/xml/user/topalbums.xml
|
124
|
+
- test/fixtures/xml/user/toptracks.xml
|
125
|
+
- test/fixtures/xml/user/recentlovedtracks.xml
|
126
|
+
- test/fixtures/xml/user/recenttracks.xml
|
127
|
+
- test/fixtures/xml/user/friends.xml
|
128
|
+
- test/fixtures/xml/user/profile.xml
|
129
|
+
- test/fixtures/xml/user/topartists.xml
|
130
|
+
- test/fixtures/xml/user/systemrecs.xml
|
131
|
+
- test/fixtures/xml/user/neighbours.xml
|
132
|
+
- Manifest
|
133
|
+
has_rdoc: true
|
134
|
+
homepage: http://scrobbler.rubyforge.org
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options:
|
137
|
+
- --line-numbers
|
138
|
+
- --inline-source
|
139
|
+
- --title
|
140
|
+
- Scrobbler
|
141
|
+
- --main
|
142
|
+
- README.rdoc
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: "0"
|
150
|
+
version:
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: "1.2"
|
156
|
+
version:
|
157
|
+
requirements: []
|
158
|
+
|
159
|
+
rubyforge_project: scrobbler
|
160
|
+
rubygems_version: 1.2.0
|
161
|
+
signing_key:
|
162
|
+
specification_version: 2
|
163
|
+
summary: wrapper for audioscrobbler (last.fm) web services
|
164
|
+
test_files:
|
165
|
+
- test/unit/album_test.rb
|
166
|
+
- test/unit/playing_test.rb
|
167
|
+
- test/unit/scrobble_test.rb
|
168
|
+
- test/unit/artist_test.rb
|
169
|
+
- test/unit/chart_test.rb
|
170
|
+
- test/unit/track_test.rb
|
171
|
+
- test/unit/tag_test.rb
|
172
|
+
- test/unit/search_test.rb
|
173
|
+
- test/unit/simpleauth_test.rb
|
174
|
+
- test/unit/user_test.rb
|
175
|
+
- test/test_helper.rb
|