firstfm 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +49 -18
- data/VERSION.yml +1 -1
- data/firstfm.gemspec +27 -32
- data/lib/firstfm.rb +2 -3
- data/lib/firstfm/artist.rb +25 -44
- data/lib/firstfm/geo.rb +32 -33
- data/lib/firstfm/location.rb +8 -8
- data/lib/firstfm/track.rb +15 -15
- data/lib/firstfm/user.rb +9 -9
- data/lib/firstfm/venue.rb +16 -16
- data/test/fixtures/artist.json +229 -0
- data/test/fixtures/artists.json +890 -0
- data/test/fixtures/events.json +173 -0
- data/test/fixtures/geo_event.json +98 -0
- data/test/fixtures/geo_events.json +845 -0
- data/test/fixtures/geo_get_metro_artist_chart.json +77 -0
- data/test/fixtures/get_correction.json +14 -0
- data/test/fixtures/get_correction_blank.json +1 -0
- data/test/fixtures/top_tracks.json +1711 -0
- data/test/fixtures/tracks.json +679 -0
- data/test/fixtures/user_artists.json +78 -0
- data/test/fixtures/venues.json +98 -0
- data/test/test_artist.rb +23 -32
- data/test/test_geo.rb +75 -75
- data/test/test_track.rb +10 -11
- data/test/test_user.rb +6 -7
- data/test/test_venue.rb +23 -44
- metadata +40 -78
- data/test/fixtures/artist.xml +0 -112
- data/test/fixtures/artists.xml +0 -371
- data/test/fixtures/event.xml +0 -54
- data/test/fixtures/events.xml +0 -128
- data/test/fixtures/geo_event.xml +0 -54
- data/test/fixtures/geo_events.xml +0 -109
- data/test/fixtures/geo_get_metro_artist_chart.xml +0 -29
- data/test/fixtures/get_correction.xml +0 -11
- data/test/fixtures/get_correction_blank.xml +0 -5
- data/test/fixtures/get_images.xml +0 -913
- data/test/fixtures/top_tracks.xml +0 -844
- data/test/fixtures/tracks.xml +0 -362
- data/test/fixtures/user_artists.xml +0 -29
- data/test/fixtures/venue.xml +0 -32
- data/test/fixtures/venues.xml +0 -54
@@ -0,0 +1,78 @@
|
|
1
|
+
{
|
2
|
+
"topartists": {
|
3
|
+
"artist": [
|
4
|
+
{
|
5
|
+
"name": "Dream Theater",
|
6
|
+
"playcount": "1859",
|
7
|
+
"mbid": "28503ab7-8bf2-4666-a7bd-2644bfc7cb1d",
|
8
|
+
"url": "http:\/\/www.last.fm\/music\/Dream+Theater",
|
9
|
+
"streamable": "0",
|
10
|
+
"image": [
|
11
|
+
{
|
12
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/34\/65549370.jpg",
|
13
|
+
"size": "small"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/64\/65549370.jpg",
|
17
|
+
"size": "medium"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/126\/65549370.jpg",
|
21
|
+
"size": "large"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/252\/65549370.jpg",
|
25
|
+
"size": "extralarge"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/_\/65549370\/Dream+Theater+dreamtheater2011new2.jpg",
|
29
|
+
"size": "mega"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"@attr": {
|
33
|
+
"rank": "1"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"name": "Dire Straits",
|
38
|
+
"playcount": "1604",
|
39
|
+
"mbid": "614e3804-7d34-41ba-857f-811bad7c2b7a",
|
40
|
+
"url": "http:\/\/www.last.fm\/music\/Dire+Straits",
|
41
|
+
"streamable": "0",
|
42
|
+
"image": [
|
43
|
+
{
|
44
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/34\/38129505.png",
|
45
|
+
"size": "small"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/64\/38129505.png",
|
49
|
+
"size": "medium"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/126\/38129505.png",
|
53
|
+
"size": "large"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/252\/38129505.png",
|
57
|
+
"size": "extralarge"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/500\/38129505\/Dire+Straits.png",
|
61
|
+
"size": "mega"
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"@attr": {
|
65
|
+
"rank": "2"
|
66
|
+
}
|
67
|
+
}
|
68
|
+
],
|
69
|
+
"@attr": {
|
70
|
+
"user": "RJ",
|
71
|
+
"type": "overall",
|
72
|
+
"page": "1",
|
73
|
+
"perPage": "50",
|
74
|
+
"totalPages": "176",
|
75
|
+
"total": "8778"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
{
|
2
|
+
"results": {
|
3
|
+
"opensearch:Query": {
|
4
|
+
"#text": "",
|
5
|
+
"role": "request",
|
6
|
+
"searchTerms": "arena",
|
7
|
+
"startPage": "1"
|
8
|
+
},
|
9
|
+
"opensearch:totalResults": "3105",
|
10
|
+
"opensearch:startIndex": "0",
|
11
|
+
"opensearch:itemsPerPage": "50",
|
12
|
+
"venuematches": {
|
13
|
+
"venue": [
|
14
|
+
{
|
15
|
+
"id": "8778545",
|
16
|
+
"name": "Arena",
|
17
|
+
"location": {
|
18
|
+
"geo:point": {
|
19
|
+
"geo:lat": "48.187281",
|
20
|
+
"geo:long": "16.412927"
|
21
|
+
},
|
22
|
+
"city": "Vienna",
|
23
|
+
"country": "Austria",
|
24
|
+
"street": "Baumgasse 80",
|
25
|
+
"postalcode": "1030"
|
26
|
+
},
|
27
|
+
"url": "http:\/\/www.last.fm\/venue\/8778545+Arena",
|
28
|
+
"website": "http:\/\/arenavie.com\/web",
|
29
|
+
"phonenumber": "+43-(0)1-7988595",
|
30
|
+
"image": [
|
31
|
+
{
|
32
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/34\/2149974.jpg",
|
33
|
+
"size": "small"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/64\/2149974.jpg",
|
37
|
+
"size": "medium"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/126\/2149974.jpg",
|
41
|
+
"size": "large"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/252\/2149974.jpg",
|
45
|
+
"size": "extralarge"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/_\/2149974\/Arena.jpg",
|
49
|
+
"size": "mega"
|
50
|
+
}
|
51
|
+
]
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"id": "10319137",
|
55
|
+
"name": "Arena Anhembi",
|
56
|
+
"location": {
|
57
|
+
"geo:point": {
|
58
|
+
"geo:lat": "-23.515061",
|
59
|
+
"geo:long": "-46.640958"
|
60
|
+
},
|
61
|
+
"city": "S\u00e3o Paulo",
|
62
|
+
"country": "Brazil",
|
63
|
+
"street": "Av. Olavo Fontoura, 1.209 - Santana",
|
64
|
+
"postalcode": "02012-021"
|
65
|
+
},
|
66
|
+
"url": "http:\/\/www.last.fm\/venue\/10319137+Arena+Anhembi",
|
67
|
+
"website": "http:\/\/www.anhembi.com.br",
|
68
|
+
"phonenumber": "(11) 2226-0400",
|
69
|
+
"image": [
|
70
|
+
{
|
71
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/34\/103421661.png",
|
72
|
+
"size": "small"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/64\/103421661.png",
|
76
|
+
"size": "medium"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/126\/103421661.png",
|
80
|
+
"size": "large"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/252\/103421661.png",
|
84
|
+
"size": "extralarge"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"#text": "http:\/\/userserve-ak.last.fm\/serve\/_\/103421661\/Arena+Anhembi.png",
|
88
|
+
"size": "mega"
|
89
|
+
}
|
90
|
+
]
|
91
|
+
}
|
92
|
+
]
|
93
|
+
},
|
94
|
+
"@attr": {
|
95
|
+
"for": "arena"
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
data/test/test_artist.rb
CHANGED
@@ -1,71 +1,62 @@
|
|
1
1
|
require 'helper'
|
2
|
-
|
2
|
+
|
3
3
|
class TestArtist < Test::Unit::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
def test_should_search_artists
|
6
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/artists.
|
6
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/artists.json"))
|
7
7
|
artists = Firstfm::Artist.search("Cher")
|
8
8
|
assert_equal 30, artists.size
|
9
9
|
assert_equal 9, artists.total_pages
|
10
10
|
assert_equal 1, artists.current_page
|
11
11
|
assert_equal 424, artists.total_entries
|
12
12
|
artist = artists.first
|
13
|
-
assert_equal "
|
14
|
-
assert_equal
|
15
|
-
assert_equal "http://www.last.fm/music/
|
16
|
-
assert_equal "
|
17
|
-
assert artist.streamable
|
13
|
+
assert_equal "Cheryl Cole", artist.name
|
14
|
+
assert_equal 627821, artist.listeners
|
15
|
+
assert_equal "http://www.last.fm/music/Cheryl+Cole", artist.url
|
16
|
+
assert_equal "2d499150-1c42-4ffb-a90c-1cc635519d33", artist.mbid
|
17
|
+
assert !artist.streamable
|
18
18
|
assert_equal 5, artist.images.size
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def test_should_get_top_tracks
|
22
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/top_tracks.
|
22
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/top_tracks.json"))
|
23
23
|
tracks = Firstfm::Artist.get_top_tracks("Cher")
|
24
24
|
assert_equal 50, tracks.size
|
25
|
-
assert_equal
|
25
|
+
assert_equal 509, tracks.total_pages
|
26
26
|
assert_equal 1, tracks.current_page
|
27
|
-
assert_equal
|
27
|
+
assert_equal 25441, tracks.total_entries
|
28
28
|
track = tracks.first
|
29
29
|
assert_equal "Believe", track.name
|
30
|
-
assert_equal
|
30
|
+
assert_equal 371216, track.listeners
|
31
31
|
assert_equal "http://www.last.fm/music/Cher/_/Believe", track.url
|
32
|
-
assert_equal
|
33
|
-
assert track.streamable
|
32
|
+
assert_equal "32ca187e-ee25-4f18-b7d0-3b6713f24635", track.mbid
|
33
|
+
assert !track.streamable
|
34
34
|
assert_equal 4, track.images.size
|
35
35
|
assert_equal 1, track.rank
|
36
36
|
assert_equal "Cher", track.artist.name
|
37
37
|
end
|
38
|
-
|
39
|
-
def test_should_get_images
|
40
|
-
artist = Firstfm::Artist.new :name => "Cher"
|
41
|
-
|
42
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/get_images.xml"))
|
43
|
-
images = artist.get_images
|
44
|
-
assert_equal 50, images.size
|
45
|
-
assert images.detect {|i| i.with_width(600) }
|
46
|
-
end
|
47
38
|
|
48
39
|
def test_should_get_tags
|
49
40
|
artist = Firstfm::Artist.new :name => "Cher"
|
50
|
-
|
51
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/artist.
|
41
|
+
|
42
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/artist.json"))
|
52
43
|
tags = artist.get_tags
|
53
44
|
assert_equal 5, tags.size
|
54
45
|
assert (tags - ["pop", "female vocalists", "80s", "dance", "rock"]).empty?
|
55
46
|
end
|
56
|
-
|
47
|
+
|
57
48
|
def test_should_get_correction
|
58
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/get_correction.
|
49
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/get_correction.json"))
|
59
50
|
artist = Firstfm::Artist.get_correction("Guns")
|
60
51
|
assert_equal "Guns N' Roses", artist.name
|
61
|
-
assert_equal "
|
52
|
+
assert_equal "eeb1195b-f213-4ce1-b28c-8565211f8e43", artist.mbid
|
62
53
|
assert_equal "http://www.last.fm/music/Guns+N%27+Roses", artist.url
|
63
54
|
end
|
64
|
-
|
55
|
+
|
65
56
|
def test_should_get_correction_even_if_correct
|
66
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/get_correction_blank.
|
57
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/get_correction_blank.json"))
|
67
58
|
artist = Firstfm::Artist.get_correction("Eminem")
|
68
59
|
assert_equal "Eminem", artist.name
|
69
60
|
end
|
70
|
-
|
61
|
+
|
71
62
|
end
|
data/test/test_geo.rb
CHANGED
@@ -1,114 +1,114 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'helper'
|
4
|
-
|
4
|
+
|
5
5
|
class TestGeo < Test::Unit::TestCase
|
6
|
-
|
6
|
+
|
7
7
|
def test_should_get_events
|
8
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_events.
|
8
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_events.json"))
|
9
9
|
events = Firstfm::Geo.get_events
|
10
|
-
assert_equal
|
11
|
-
|
10
|
+
assert_equal 10, events.size
|
11
|
+
|
12
12
|
event = events.first
|
13
|
-
assert_equal "
|
14
|
-
assert_equal "
|
15
|
-
assert_equal "La
|
16
|
-
|
13
|
+
assert_equal "Fiestas de La Paloma", event.title
|
14
|
+
assert_equal "4174420", event.id
|
15
|
+
assert_equal "Fiestas de La Paloma - Plaza de las Vistillas", event.venue.name
|
16
|
+
|
17
17
|
event = events.last
|
18
|
-
assert_equal "
|
19
|
-
assert_equal "
|
20
|
-
assert_equal "
|
18
|
+
assert_equal "XIV LechuRock", event.title
|
19
|
+
assert_equal "4161678", event.id
|
20
|
+
assert_equal "Plaza de toros", event.venue.name
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def test_should_get_events_with_one_event_as_result
|
24
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_event.
|
24
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_event.json"))
|
25
25
|
events = Firstfm::Geo.get_events
|
26
26
|
assert_equal 1, events.size
|
27
|
-
|
27
|
+
|
28
28
|
event = events.first
|
29
|
-
assert_equal "
|
30
|
-
assert_equal "
|
31
|
-
assert_equal "La
|
29
|
+
assert_equal "Fiestas de La Paloma", event.title
|
30
|
+
assert_equal "4174420", event.id
|
31
|
+
assert_equal "Fiestas de La Paloma - Plaza de las Vistillas", event.venue.name
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def test_should_get_metro_artist_chart
|
35
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.
|
35
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.json"))
|
36
36
|
artists = Firstfm::Geo.get_metro_artist_chart
|
37
37
|
assert_equal 2, artists.size
|
38
38
|
artist1 = artists.first
|
39
39
|
artist2 = artists.last
|
40
|
-
|
41
|
-
assert_equal "
|
42
|
-
assert_equal "
|
43
|
-
assert_equal "http://www.last.fm/music/
|
44
|
-
assert_equal
|
45
|
-
assert artist1.streamable
|
46
|
-
|
47
|
-
assert_equal "
|
48
|
-
assert_equal "
|
49
|
-
assert_equal "http://www.last.fm/music/
|
50
|
-
assert_equal
|
51
|
-
assert artist2.streamable
|
40
|
+
|
41
|
+
assert_equal "Muse", artist1.name
|
42
|
+
assert_equal "1695c115-bf3f-4014-9966-2b0c50179193", artist1.mbid
|
43
|
+
assert_equal "http://www.last.fm/music/Muse", artist1.url
|
44
|
+
assert_equal 359, artist1.listeners
|
45
|
+
assert !artist1.streamable
|
46
|
+
|
47
|
+
assert_equal "Major Lazer", artist2.name
|
48
|
+
assert_equal "75be165a-ad83-4d12-bd28-f589a15c479f", artist2.mbid
|
49
|
+
assert_equal "http://www.last.fm/music/Major+Lazer", artist2.url
|
50
|
+
assert_equal 310, artist2.listeners
|
51
|
+
assert !artist2.streamable
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def test_should_get_metro_hype_artist_chart
|
55
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.
|
55
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.json"))
|
56
56
|
artists = Firstfm::Geo.get_metro_hype_artist_chart
|
57
57
|
assert_equal 2, artists.size
|
58
58
|
artist1 = artists.first
|
59
59
|
artist2 = artists.last
|
60
|
-
|
61
|
-
assert_equal "
|
62
|
-
assert_equal "
|
63
|
-
assert_equal "http://www.last.fm/music/
|
64
|
-
assert_equal
|
65
|
-
assert artist1.streamable
|
66
|
-
|
67
|
-
assert_equal "
|
68
|
-
assert_equal "
|
69
|
-
assert_equal "http://www.last.fm/music/
|
70
|
-
assert_equal
|
71
|
-
assert artist2.streamable
|
60
|
+
|
61
|
+
assert_equal "Muse", artist1.name
|
62
|
+
assert_equal "1695c115-bf3f-4014-9966-2b0c50179193", artist1.mbid
|
63
|
+
assert_equal "http://www.last.fm/music/Muse", artist1.url
|
64
|
+
assert_equal 359, artist1.listeners
|
65
|
+
assert !artist1.streamable
|
66
|
+
|
67
|
+
assert_equal "Major Lazer", artist2.name
|
68
|
+
assert_equal "75be165a-ad83-4d12-bd28-f589a15c479f", artist2.mbid
|
69
|
+
assert_equal "http://www.last.fm/music/Major+Lazer", artist2.url
|
70
|
+
assert_equal 310, artist2.listeners
|
71
|
+
assert !artist2.streamable
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def test_should_get_metro_unique_artist_chart
|
75
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.
|
75
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.json"))
|
76
76
|
artists = Firstfm::Geo.get_metro_unique_artist_chart
|
77
77
|
assert_equal 2, artists.size
|
78
78
|
artist1 = artists.first
|
79
79
|
artist2 = artists.last
|
80
|
-
|
81
|
-
assert_equal "
|
82
|
-
assert_equal "
|
83
|
-
assert_equal "http://www.last.fm/music/
|
84
|
-
assert_equal
|
85
|
-
assert artist1.streamable
|
86
|
-
|
87
|
-
assert_equal "
|
88
|
-
assert_equal "
|
89
|
-
assert_equal "http://www.last.fm/music/
|
90
|
-
assert_equal
|
91
|
-
assert artist2.streamable
|
80
|
+
|
81
|
+
assert_equal "Muse", artist1.name
|
82
|
+
assert_equal "1695c115-bf3f-4014-9966-2b0c50179193", artist1.mbid
|
83
|
+
assert_equal "http://www.last.fm/music/Muse", artist1.url
|
84
|
+
assert_equal 359, artist1.listeners
|
85
|
+
assert !artist1.streamable
|
86
|
+
|
87
|
+
assert_equal "Major Lazer", artist2.name
|
88
|
+
assert_equal "75be165a-ad83-4d12-bd28-f589a15c479f", artist2.mbid
|
89
|
+
assert_equal "http://www.last.fm/music/Major+Lazer", artist2.url
|
90
|
+
assert_equal 310, artist2.listeners
|
91
|
+
assert !artist2.streamable
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
def test_should_get_top_artists
|
95
|
-
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.
|
95
|
+
FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/geo_get_metro_artist_chart.json"))
|
96
96
|
artists = Firstfm::Geo.get_top_artists
|
97
97
|
assert_equal 2, artists.size
|
98
98
|
artist1 = artists.first
|
99
99
|
artist2 = artists.last
|
100
|
-
|
101
|
-
assert_equal "
|
102
|
-
assert_equal "
|
103
|
-
assert_equal "http://www.last.fm/music/
|
104
|
-
assert_equal
|
105
|
-
assert artist1.streamable
|
106
|
-
|
107
|
-
assert_equal "
|
108
|
-
assert_equal "
|
109
|
-
assert_equal "http://www.last.fm/music/
|
110
|
-
assert_equal
|
111
|
-
assert artist2.streamable
|
100
|
+
|
101
|
+
assert_equal "Muse", artist1.name
|
102
|
+
assert_equal "1695c115-bf3f-4014-9966-2b0c50179193", artist1.mbid
|
103
|
+
assert_equal "http://www.last.fm/music/Muse", artist1.url
|
104
|
+
assert_equal 359, artist1.listeners
|
105
|
+
assert !artist1.streamable
|
106
|
+
|
107
|
+
assert_equal "Major Lazer", artist2.name
|
108
|
+
assert_equal "75be165a-ad83-4d12-bd28-f589a15c479f", artist2.mbid
|
109
|
+
assert_equal "http://www.last.fm/music/Major+Lazer", artist2.url
|
110
|
+
assert_equal 310, artist2.listeners
|
111
|
+
assert !artist2.streamable
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
end
|