scrobbler-ng 2.0.10 → 2.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -3
- data/VERSION.yml +2 -2
- data/lib/scrobbler/artist.rb +8 -3
- data/lib/scrobbler/base.rb +16 -1
- data/lib/scrobbler/helper/image.rb +1 -1
- data/lib/scrobbler/user.rb +33 -2
- data/scrobbler-ng.gemspec +43 -71
- data/tasks/rdoc.rake +2 -1
- data/tasks/tests.rake +3 -21
- metadata +55 -131
- data/test/mocks/library.rb +0 -35
- data/test/mocks/rest.rb +0 -127
- data/test/spec_helper.rb +0 -7
- data/test/test_helper.rb +0 -6
- data/test/unit/album_spec.rb +0 -61
- data/test/unit/artist_spec.rb +0 -132
- data/test/unit/authentication_spec.rb +0 -51
- data/test/unit/event_spec.rb +0 -105
- data/test/unit/geo_spec.rb +0 -148
- data/test/unit/library_spec.rb +0 -133
- data/test/unit/playing_test.rb +0 -53
- data/test/unit/playlist_spec.rb +0 -25
- data/test/unit/radio_spec.rb +0 -22
- data/test/unit/simpleauth_test.rb +0 -45
- data/test/unit/tag_spec.rb +0 -103
- data/test/unit/track_spec.rb +0 -105
- data/test/unit/user_spec.rb +0 -264
- data/test/unit/venue_spec.rb +0 -105
data/test/unit/geo_spec.rb
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
-
|
3
|
-
describe Scrobbler::Geo do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@geo = Scrobbler::Geo.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe 'should implement the method' do
|
10
|
-
[:events,:top_tracks,:top_artists].each do |method_name|
|
11
|
-
it "'#{method_name}'" do
|
12
|
-
@geo.should respond_to(method_name)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'finding by location' do
|
18
|
-
before do
|
19
|
-
@event_titles = ['Will and The People','Son Of Dave','Surface Unsigned','Experimental Dental School']
|
20
|
-
@event_ids = [1025661,954053,1005964,909456]
|
21
|
-
@first_atrists_names = ['Will And The People','Carnations','Midwich Cuckoos','NO FLASH']
|
22
|
-
@first_headliner = 'Will And The People'
|
23
|
-
@top_artist_names = ['The Killers','Coldplay','Radiohead','Muse','Franz Ferdinand','U2']
|
24
|
-
@top_track_names = ['Use Somebody','Schwarz zu Blau','Sex on Fire','Alles Neu','Poker Face','Ayo Technology']
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'events in manchester' do
|
28
|
-
before do
|
29
|
-
@events = @geo.events(:location => 'Manchester')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should find 4 events' do
|
33
|
-
@events.size.should eql 4
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should have the correct event id's" do
|
37
|
-
@events.collect(&:id).should eql @event_ids
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should have the correct event titles' do
|
41
|
-
@events.collect(&:title).should eql @event_titles
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'finding top artists in spain' do
|
46
|
-
before do
|
47
|
-
@top_artists = @geo.top_artists(:location => 'Spain')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should find 6 artists' do
|
51
|
-
@top_artists.size.should eql 6
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should have the correct artist names' do
|
55
|
-
@top_artists.collect(&:name).should eql @top_artist_names
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'finding top tracks in germany' do
|
60
|
-
before do
|
61
|
-
@top_tracks = @geo.top_tracks(:location => 'Germany')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should find 6 top tracks' do
|
65
|
-
@top_tracks.size.should eql 6
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should have the correct top track names' do
|
69
|
-
@top_track_names.should eql @top_tracks.collect(&:name)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
describe 'finding by latitude and longitude' do
|
76
|
-
describe 'events in 40.71417 -74.00639' do
|
77
|
-
before do
|
78
|
-
@events = @geo.events(:lat => 40.71417, :long => -74.00639)
|
79
|
-
@event_ids = [1066470, 990602, 1062713, 1088394]
|
80
|
-
@event_titles = ["We Love Brasil", "Red Bank Jazz and Blues Festival", "Jazz For Young People", "The Paul Green School Of Rock"]
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'should find 4 events' do
|
84
|
-
@events.size.should eql 4
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should have the correct event id's" do
|
88
|
-
@events.collect(&:id).should eql @event_ids
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should have the correct event titles' do
|
92
|
-
@events.collect(&:title).should eql @event_titles
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe 'finding by distance' do
|
98
|
-
describe 'events within 15km' do
|
99
|
-
before do
|
100
|
-
@events = @geo.events(:distance => 15)
|
101
|
-
@event_ids = [926134, 1046018, 1070375, 805363]
|
102
|
-
@event_titles = ["Feast - Picnic by the Lake", "Bootleg Beatles", "The Lucid Dream", "Oasis"]
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'should find 4 events' do
|
106
|
-
@events.size.should eql 4
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should have the correct event id's" do
|
110
|
-
@events.collect(&:id).should eql @event_ids
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'should have the correct event titles' do
|
114
|
-
@events.collect(&:title).should eql @event_titles
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe 'pagination' do
|
120
|
-
describe 'page two of events in manchester' do
|
121
|
-
before do
|
122
|
-
@page = @geo.events(:location => 'Manchester', :page => 2)
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'should have 10 events' do
|
126
|
-
@page.size.should eql(10)
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'should have the correct title for the first event' do
|
130
|
-
@page.first.title.should eql('New Bruises')
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe 'page three of events in manchester' do
|
135
|
-
before do
|
136
|
-
@page = @geo.events(:location => 'Manchester', :page => 3)
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'should have 10 events' do
|
140
|
-
@page.size.should eql(10)
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'should have the correct title for the first event' do
|
144
|
-
@page.first.title.should eql('Saving Aimee')
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
data/test/unit/library_spec.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
-
|
3
|
-
describe Scrobbler::Library do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@library = Scrobbler::Library.new('xhochy')
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should know its username' do
|
10
|
-
@library.user.should be_kind_of(Scrobbler::User)
|
11
|
-
@library.user.name.should eql('xhochy')
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should implement all methods from the Last.fm 2.0 API' do
|
15
|
-
@library.should respond_to(:add_album)
|
16
|
-
@library.should respond_to(:add_artist)
|
17
|
-
@library.should respond_to(:add_track)
|
18
|
-
@library.should respond_to(:albums)
|
19
|
-
@library.should respond_to(:artists)
|
20
|
-
@library.should respond_to(:tracks)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should be able to add an album'
|
24
|
-
|
25
|
-
it 'should be able to add an artist'
|
26
|
-
|
27
|
-
it 'should be able to add a track'
|
28
|
-
|
29
|
-
it 'should be able to get its albums' do
|
30
|
-
@library.should have(396).albums
|
31
|
-
first = @library.albums.first
|
32
|
-
first.should be_kind_of(Scrobbler::Album)
|
33
|
-
first.name.should ==('Silent Alarm')
|
34
|
-
first.playcount.should ==(1043)
|
35
|
-
first.tagcount.should ==(0)
|
36
|
-
first.mbid.should ==('7e18e965-cbc7-43d6-9042-daba4f984a34')
|
37
|
-
first.url.should ==('http://www.last.fm/music/Bloc+Party/Silent+Alarm')
|
38
|
-
first.artist.should be_kind_of(Scrobbler::Artist)
|
39
|
-
first.artist.name.should ==('Bloc Party')
|
40
|
-
first.artist.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
|
41
|
-
first.artist.url.should ==('http://www.last.fm/music/Bloc+Party')
|
42
|
-
first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/9903887.jpg')
|
43
|
-
first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/9903887.jpg')
|
44
|
-
first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/9903887.jpg')
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should be able to get its 30 most heard albums' do
|
48
|
-
@library.albums(:all => false, :limit => 30).should have(30).items
|
49
|
-
first = @library.albums(:all => false, :limit => 30).first
|
50
|
-
first.should be_kind_of(Scrobbler::Album)
|
51
|
-
first.name.should ==('Silent Alarm')
|
52
|
-
first.playcount.should ==(1043)
|
53
|
-
first.tagcount.should ==(0)
|
54
|
-
first.mbid.should ==('7e18e965-cbc7-43d6-9042-daba4f984a34')
|
55
|
-
first.url.should ==('http://www.last.fm/music/Bloc+Party/Silent+Alarm')
|
56
|
-
first.artist.should be_kind_of(Scrobbler::Artist)
|
57
|
-
first.artist.name.should ==('Bloc Party')
|
58
|
-
first.artist.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
|
59
|
-
first.artist.url.should ==('http://www.last.fm/music/Bloc+Party')
|
60
|
-
first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/9903887.jpg')
|
61
|
-
first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/9903887.jpg')
|
62
|
-
first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/9903887.jpg')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should be able to get its artists' do
|
66
|
-
@library.should have(340).artists
|
67
|
-
first = @library.artists.first
|
68
|
-
first.should be_kind_of(Scrobbler::Artist)
|
69
|
-
first.name.should ==('Bloc Party')
|
70
|
-
first.playcount.should ==(2314)
|
71
|
-
first.tagcount.should ==(0)
|
72
|
-
first.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
|
73
|
-
first.url.should ==('http://www.last.fm/music/Bloc+Party')
|
74
|
-
first.streamable.should be_true
|
75
|
-
first.image(:small).should ==('http://userserve-ak.last.fm/serve/34/115908.jpg')
|
76
|
-
first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64/115908.jpg')
|
77
|
-
first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/115908.jpg')
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'should be able to get its 30 most heard artists' do
|
81
|
-
@library.artists(:all => false, :limit => 30).should have(30).items
|
82
|
-
first = @library.artists(:all => false, :limit => 30).first
|
83
|
-
first.should be_kind_of(Scrobbler::Artist)
|
84
|
-
first.name.should ==('Bloc Party')
|
85
|
-
first.playcount.should ==(2314)
|
86
|
-
first.tagcount.should ==(0)
|
87
|
-
first.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
|
88
|
-
first.url.should ==('http://www.last.fm/music/Bloc+Party')
|
89
|
-
first.streamable.should be_true
|
90
|
-
first.image(:small).should ==('http://userserve-ak.last.fm/serve/34/115908.jpg')
|
91
|
-
first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64/115908.jpg')
|
92
|
-
first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/115908.jpg')
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should be able to get its tracks' do
|
96
|
-
@library.should have(1686).tracks
|
97
|
-
first = @library.tracks.first
|
98
|
-
first.should be_kind_of(Scrobbler::Track)
|
99
|
-
first.name.should ==('A-Punk')
|
100
|
-
first.playcount.should ==(185)
|
101
|
-
first.tagcount.should ==(0)
|
102
|
-
first.mbid.should ==('')
|
103
|
-
first.url.should ==('http://www.last.fm/music/Vampire+Weekend/_/A-Punk')
|
104
|
-
first.streamable.should be_false
|
105
|
-
first.artist.should be_kind_of(Scrobbler::Artist)
|
106
|
-
first.artist.name.should ==('Vampire Weekend')
|
107
|
-
first.artist.mbid.should ==('af37c51c-0790-4a29-b995-456f98a6b8c9')
|
108
|
-
first.artist.url.should ==('http://www.last.fm/music/Vampire+Weekend')
|
109
|
-
first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/10258165.jpg')
|
110
|
-
first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/10258165.jpg')
|
111
|
-
first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/10258165.jpg')
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'should be able to get its 30 most heard tracks' do
|
115
|
-
@library.tracks(:all => false, :limit => 30).should have(30).items
|
116
|
-
first = @library.tracks(:all => false, :limit => 30).first
|
117
|
-
first.should be_kind_of(Scrobbler::Track)
|
118
|
-
first.name.should ==('A-Punk')
|
119
|
-
first.playcount.should ==(185)
|
120
|
-
first.tagcount.should ==(0)
|
121
|
-
first.mbid.should ==('')
|
122
|
-
first.url.should ==('http://www.last.fm/music/Vampire+Weekend/_/A-Punk')
|
123
|
-
first.streamable.should be_false
|
124
|
-
first.artist.should be_kind_of(Scrobbler::Artist)
|
125
|
-
first.artist.name.should ==('Vampire Weekend')
|
126
|
-
first.artist.mbid.should ==('af37c51c-0790-4a29-b995-456f98a6b8c9')
|
127
|
-
first.artist.url.should ==('http://www.last.fm/music/Vampire+Weekend')
|
128
|
-
first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/10258165.jpg')
|
129
|
-
first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/10258165.jpg')
|
130
|
-
first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/10258165.jpg')
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
data/test/unit/playing_test.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
-
|
3
|
-
class TestPlaying < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@session_id = '17E61E13454CDD8B68E8D7DEEEDF6170'
|
7
|
-
@now_playing_url = 'http://62.216.251.203:80/nowplaying'
|
8
|
-
@artist = 'Anberlin'
|
9
|
-
@track = 'A Day Late'
|
10
|
-
@album = 'Never Take Friendship Personal'
|
11
|
-
|
12
|
-
@playing = Scrobbler::Playing.new(:session_id => @session_id, :now_playing_url => @now_playing_url,
|
13
|
-
:artist => @artist, :track => @track, :album => @album, :length => 214,
|
14
|
-
:track_number => 5)
|
15
|
-
end
|
16
|
-
|
17
|
-
test 'should require a session id' do
|
18
|
-
assert_raises(ArgumentError) { Scrobbler::Playing.new(
|
19
|
-
:now_playing_url => @now_playing_url, :artist => @artist, :track => @track,
|
20
|
-
:album => @album, :length => 214, :track_number => 5) }
|
21
|
-
end
|
22
|
-
|
23
|
-
test 'should require a now playing url' do
|
24
|
-
assert_raises(ArgumentError) { Scrobbler::Playing.new(
|
25
|
-
:session_id => @session_id, :artist => @artist, :track => @track,
|
26
|
-
:album => @album, :length => 214, :track_number => 5) }
|
27
|
-
end
|
28
|
-
|
29
|
-
test 'should require an artist' do
|
30
|
-
assert_raises(ArgumentError) { Scrobbler::Playing.new(
|
31
|
-
:session_id => @session_id, :now_playing_url => @now_playing_url,
|
32
|
-
:track => @track, :album => @album, :length => 214, :track_number => 5) }
|
33
|
-
end
|
34
|
-
|
35
|
-
test 'should require a track' do
|
36
|
-
assert_raises(ArgumentError) { Scrobbler::Playing.new(
|
37
|
-
:session_id => @session_id, :now_playing_url => @now_playing_url,
|
38
|
-
:artist => @artist, :album => @album, :length => 214, :track_number => 5) }
|
39
|
-
end
|
40
|
-
|
41
|
-
test 'should require a length greater than 30 seconds' do
|
42
|
-
assert_raises(ArgumentError) { Scrobbler::Playing.new(
|
43
|
-
:session_id => @session_id, :now_playing_url => @now_playing_url,
|
44
|
-
:artist => @artist, :track => @track, :album => @album, :length => 29,
|
45
|
-
:track_number => 5) }
|
46
|
-
end
|
47
|
-
|
48
|
-
test 'should submit successfully' do
|
49
|
-
@playing.submit!
|
50
|
-
assert_equal('OK', @playing.status)
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
data/test/unit/playlist_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
-
|
3
|
-
describe Scrobbler::Playlist do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@playlist = Scrobbler::Playlist.new(:url => 'lastfm://playlist/album/2026126')
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should know its url' do
|
10
|
-
@playlist.url.should eql('lastfm://playlist/album/2026126')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should implement all methods from the Last.fm 2.0 API' do
|
14
|
-
@playlist.should respond_to(:fetch)
|
15
|
-
@playlist.should respond_to(:add_track)
|
16
|
-
Scrobbler::Playlist.should respond_to(:create)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should be able to add a track'
|
20
|
-
|
21
|
-
it 'should be able to create a new'
|
22
|
-
|
23
|
-
it 'should be able to fetch more information'
|
24
|
-
|
25
|
-
end
|
data/test/unit/radio_spec.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
-
|
3
|
-
describe Scrobbler::Radio do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@radio = Scrobbler::Radio.new('lastfm://globaltags/disco')
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should know its station' do
|
10
|
-
@radio.station.should eql('lastfm://globaltags/disco')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should implement all methods from the Last.fm 2.0 API' do
|
14
|
-
@radio.should respond_to(:tune)
|
15
|
-
@radio.should respond_to(:playlist)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should be able to tune in'
|
19
|
-
|
20
|
-
it 'should be able to fetch the playlist'
|
21
|
-
|
22
|
-
end
|
@@ -1,45 +0,0 @@
|
|
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('0.2.13', @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
|
data/test/unit/tag_spec.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
4
|
-
|
5
|
-
describe Scrobbler::Tag do
|
6
|
-
|
7
|
-
before(:all) do
|
8
|
-
@tag = Scrobbler::Tag.new(:name => 'rock')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should know its name' do
|
12
|
-
@tag.name.should eql('rock')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should implement all methods from the Last.fm 2.0 API' do
|
16
|
-
@tag.should respond_to(:similar)
|
17
|
-
@tag.should respond_to(:top_albums)
|
18
|
-
@tag.should respond_to(:top_artists)
|
19
|
-
Scrobbler::Tag.should respond_to(:top_tags)
|
20
|
-
@tag.should respond_to(:top_tracks)
|
21
|
-
@tag.should respond_to(:weekly_artist_chart)
|
22
|
-
@tag.should respond_to(:weekly_chart_list)
|
23
|
-
Scrobbler::Tag.should respond_to(:search)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should be able to get similar tags' do
|
27
|
-
@tag.should have(50).similar
|
28
|
-
first = @tag.similar.first
|
29
|
-
first.should be_kind_of(Scrobbler::Tag)
|
30
|
-
first.name.should eql('classic rock')
|
31
|
-
first.url.should eql('http://www.last.fm/tag/classic%20rock')
|
32
|
-
first.streamable.should be_true
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should be able to find its top albums' do
|
36
|
-
@tag.top_albums.should be_kind_of(Array)
|
37
|
-
@tag.top_albums.should have(50).items
|
38
|
-
@tag.top_albums.first.should be_kind_of(Scrobbler::Album)
|
39
|
-
@tag.top_albums.first.rank.should eql(1)
|
40
|
-
@tag.top_albums.first.name.should eql('Overpowered')
|
41
|
-
@tag.top_albums.first.tagcount.should eql(105)
|
42
|
-
@tag.top_albums.first.mbid.should eql('')
|
43
|
-
@tag.top_albums.first.url.should eql('http://www.last.fm/music/R%C3%B3is%C3%ADn+Murphy/Overpowered')
|
44
|
-
@tag.top_albums.first.artist.should be_kind_of(Scrobbler::Artist)
|
45
|
-
@tag.top_albums.first.artist.name.should == 'Róisín Murphy'
|
46
|
-
@tag.top_albums.first.artist.mbid.should eql('4c56405d-ba8e-4283-99c3-1dc95bdd50e7')
|
47
|
-
@tag.top_albums.first.artist.url.should eql('http://www.last.fm/music/R%C3%B3is%C3%ADn+Murphy')
|
48
|
-
@tag.top_albums.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/26856969.png')
|
49
|
-
@tag.top_albums.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/26856969.png')
|
50
|
-
@tag.top_albums.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/26856969.png')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should be able to find its top artists' do
|
54
|
-
@tag.top_artists.should be_kind_of(Array)
|
55
|
-
@tag.top_artists.should have(50).items
|
56
|
-
@tag.top_artists.first.should be_kind_of(Scrobbler::Artist)
|
57
|
-
@tag.top_artists.first.rank.should eql(1)
|
58
|
-
@tag.top_artists.first.name.should eql('ABBA')
|
59
|
-
@tag.top_artists.first.tagcount.should eql(1229)
|
60
|
-
@tag.top_artists.first.mbid.should eql('d87e52c5-bb8d-4da8-b941-9f4928627dc8')
|
61
|
-
@tag.top_artists.first.url.should eql('http://www.last.fm/music/ABBA')
|
62
|
-
@tag.top_artists.first.streamable.should be_true
|
63
|
-
@tag.top_artists.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/135930.jpg')
|
64
|
-
@tag.top_artists.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/135930.jpg')
|
65
|
-
@tag.top_artists.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/135930.jpg')
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should be able to find global top tags' do
|
69
|
-
Scrobbler::Tag.should have(250).top_tags
|
70
|
-
first = Scrobbler::Tag.top_tags.first
|
71
|
-
first.should be_kind_of(Scrobbler::Tag)
|
72
|
-
first.name.should eql('rock')
|
73
|
-
first.count.should eql(2267576)
|
74
|
-
first.url.should eql('www.last.fm/tag/rock')
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should be able to find its top tracks' do
|
78
|
-
@tag.top_tracks.should be_kind_of(Array)
|
79
|
-
@tag.top_tracks.should have(50).items
|
80
|
-
@tag.top_tracks.first.should be_kind_of(Scrobbler::Track)
|
81
|
-
@tag.top_tracks.first.rank.should eql(1.0)
|
82
|
-
@tag.top_tracks.first.name.should eql('Stayin\' Alive')
|
83
|
-
@tag.top_tracks.first.tagcount.should eql(422)
|
84
|
-
@tag.top_tracks.first.mbid.should eql('')
|
85
|
-
@tag.top_tracks.first.streamable.should be_true
|
86
|
-
@tag.top_tracks.first.url.should eql('http://www.last.fm/music/Bee+Gees/_/Stayin%27+Alive')
|
87
|
-
@tag.top_tracks.first.artist.should be_kind_of(Scrobbler::Artist)
|
88
|
-
@tag.top_tracks.first.artist.name.should eql('Bee Gees')
|
89
|
-
@tag.top_tracks.first.artist.mbid.should eql('bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810')
|
90
|
-
@tag.top_tracks.first.artist.url.should eql('http://www.last.fm/music/Bee+Gees')
|
91
|
-
@tag.top_tracks.first.image(:small).should eql('http://images.amazon.com/images/P/B00069590Q.01._SCMZZZZZZZ_.jpg')
|
92
|
-
@tag.top_tracks.first.image(:medium).should eql('http://images.amazon.com/images/P/B00069590Q.01._SCMZZZZZZZ_.jpg')
|
93
|
-
@tag.top_tracks.first.image(:large).should eql('http://images.amazon.com/images/P/B00069590Q.01._SCMZZZZZZZ_.jpg')
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'should be able to get the weekly artist chart'
|
97
|
-
|
98
|
-
it 'should be able to get the weekly chart list'
|
99
|
-
|
100
|
-
it 'should be able to search for a tag'
|
101
|
-
|
102
|
-
end
|
103
|
-
|