lastfm 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -0
- data/lastfm.gemspec +1 -1
- data/lib/lastfm/method_category/tag.rb +4 -0
- data/spec/fixtures/tag_get_top_tracks.xml +101 -0
- data/spec/method_specs/tag_spec.rb +18 -0
- metadata +6 -4
data/README.rdoc
CHANGED
|
@@ -56,6 +56,7 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
|
|
|
56
56
|
=== Tag
|
|
57
57
|
|
|
58
58
|
* {tag.getTopArtists}[http://www.lastfm.jp/api/show/tag.getTopArtists]
|
|
59
|
+
* {tag.getTopTracks}[http://www.lastfm.jp/api/show/tag.getTopTracks]
|
|
59
60
|
|
|
60
61
|
=== Tasteometer
|
|
61
62
|
|
data/lastfm.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
|
12
12
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
13
13
|
gem.name = %q{lastfm}
|
|
14
14
|
gem.require_paths = ["lib"]
|
|
15
|
-
gem.version = "1.
|
|
15
|
+
gem.version = "1.16.0"
|
|
16
16
|
|
|
17
17
|
gem.add_dependency "xml-simple"
|
|
18
18
|
gem.add_dependency "httparty"
|
|
@@ -4,6 +4,10 @@ class Lastfm
|
|
|
4
4
|
regular_method :get_top_artists, [:tag], [[:limit, nil], [:page, nil]] do |response|
|
|
5
5
|
response.xml['topartists']['artist']
|
|
6
6
|
end
|
|
7
|
+
|
|
8
|
+
regular_method :get_top_tracks, [:tag], [[:limit, nil], [:page, nil]] do |response|
|
|
9
|
+
response.xml['toptracks']['track']
|
|
10
|
+
end
|
|
7
11
|
end
|
|
8
12
|
end
|
|
9
13
|
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<lfm status="ok">
|
|
3
|
+
<toptracks tag="Disco" page="1" perPage="5" totalPages="200" total="1000">
|
|
4
|
+
|
|
5
|
+
<track rank="1">
|
|
6
|
+
<name>Stayin' Alive</name>
|
|
7
|
+
<duration>281</duration>
|
|
8
|
+
|
|
9
|
+
<mbid>14018054-d7fa-45e4-9689-33792aade877</mbid>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<url>http://www.last.fm/music/Bee+Gees/_/Stayin%27+Alive</url>
|
|
13
|
+
<streamable fulltrack="0">1</streamable>
|
|
14
|
+
<artist>
|
|
15
|
+
<name>Bee Gees</name>
|
|
16
|
+
<mbid>bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810</mbid>
|
|
17
|
+
|
|
18
|
+
<url>http://www.last.fm/music/Bee+Gees</url>
|
|
19
|
+
</artist>
|
|
20
|
+
<image size="small">http://userserve-ak.last.fm/serve/34s/72573304.png</image>
|
|
21
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64s/72573304.png</image>
|
|
22
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/72573304.png</image>
|
|
23
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/72573304.png</image>
|
|
24
|
+
</track> <track rank="2">
|
|
25
|
+
<name>September</name>
|
|
26
|
+
<duration>218</duration>
|
|
27
|
+
|
|
28
|
+
<mbid>0548a4b8-6b8f-4266-8f9b-db822d09c30c</mbid>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<url>http://www.last.fm/music/Earth,+Wind+&+Fire/_/September</url>
|
|
32
|
+
<streamable fulltrack="0">1</streamable>
|
|
33
|
+
<artist>
|
|
34
|
+
<name>Earth, Wind & Fire</name>
|
|
35
|
+
<mbid>535afeda-2538-435d-9dd1-5e10be586774</mbid>
|
|
36
|
+
|
|
37
|
+
<url>http://www.last.fm/music/Earth,+Wind+&+Fire</url>
|
|
38
|
+
</artist>
|
|
39
|
+
<image size="small">http://userserve-ak.last.fm/serve/34s/9699191.jpg</image>
|
|
40
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64s/9699191.jpg</image>
|
|
41
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/9699191.jpg</image>
|
|
42
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/9699191.jpg</image>
|
|
43
|
+
</track> <track rank="3">
|
|
44
|
+
<name>Dancing Queen</name>
|
|
45
|
+
<duration>228</duration>
|
|
46
|
+
|
|
47
|
+
<mbid>0106d274-9da9-41c2-8f62-8ba327e38530</mbid>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<url>http://www.last.fm/music/ABBA/_/Dancing+Queen</url>
|
|
51
|
+
<streamable fulltrack="0">1</streamable>
|
|
52
|
+
<artist>
|
|
53
|
+
<name>ABBA</name>
|
|
54
|
+
<mbid>d87e52c5-bb8d-4da8-b941-9f4928627dc8</mbid>
|
|
55
|
+
|
|
56
|
+
<url>http://www.last.fm/music/ABBA</url>
|
|
57
|
+
</artist>
|
|
58
|
+
<image size="small">http://userserve-ak.last.fm/serve/34s/41774271.png</image>
|
|
59
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64s/41774271.png</image>
|
|
60
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/41774271.png</image>
|
|
61
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/41774271.png</image>
|
|
62
|
+
</track> <track rank="4">
|
|
63
|
+
<name>I Will Survive</name>
|
|
64
|
+
<duration>190</duration>
|
|
65
|
+
|
|
66
|
+
<mbid>b2f17e7a-ac67-4513-8676-148ed235cc76</mbid>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<url>http://www.last.fm/music/Gloria+Gaynor/_/I+Will+Survive</url>
|
|
70
|
+
<streamable fulltrack="0">1</streamable>
|
|
71
|
+
<artist>
|
|
72
|
+
<name>Gloria Gaynor</name>
|
|
73
|
+
<mbid>0efc0853-78ed-40f7-b5be-b1b4cc866dba</mbid>
|
|
74
|
+
|
|
75
|
+
<url>http://www.last.fm/music/Gloria+Gaynor</url>
|
|
76
|
+
</artist>
|
|
77
|
+
<image size="small">http://userserve-ak.last.fm/serve/34s/4351744.jpg</image>
|
|
78
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64s/4351744.jpg</image>
|
|
79
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/4351744.jpg</image>
|
|
80
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/4351744.jpg</image>
|
|
81
|
+
</track> <track rank="5">
|
|
82
|
+
<name>Night Fever</name>
|
|
83
|
+
<duration>211</duration>
|
|
84
|
+
|
|
85
|
+
<mbid>c2d35928-c017-4491-9da3-f59ed8e6d7c8</mbid>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<url>http://www.last.fm/music/Bee+Gees/_/Night+Fever</url>
|
|
89
|
+
<streamable fulltrack="0">0</streamable>
|
|
90
|
+
<artist>
|
|
91
|
+
<name>Bee Gees</name>
|
|
92
|
+
<mbid>bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810</mbid>
|
|
93
|
+
|
|
94
|
+
<url>http://www.last.fm/music/Bee+Gees</url>
|
|
95
|
+
</artist>
|
|
96
|
+
<image size="small">http://userserve-ak.last.fm/serve/34s/72573304.png</image>
|
|
97
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64s/72573304.png</image>
|
|
98
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/72573304.png</image>
|
|
99
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/72573304.png</image>
|
|
100
|
+
</track></toptracks></lfm>
|
|
101
|
+
|
|
@@ -22,4 +22,22 @@ describe '#tag' do
|
|
|
22
22
|
artists[1]['name'].should == 'ABBA'
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
describe '#get_top_tracks' do
|
|
27
|
+
it 'should get top tracks of a given tag' do
|
|
28
|
+
@lastfm.should_receive(:request).with('tag.getTopTracks', {
|
|
29
|
+
:tag => 'Disco',
|
|
30
|
+
:limit => 5,
|
|
31
|
+
:page => nil
|
|
32
|
+
}).and_return(make_response('tag_get_top_tracks'))
|
|
33
|
+
|
|
34
|
+
tracks = @lastfm.tag.get_top_tracks(:tag => 'Disco', :limit => 5)
|
|
35
|
+
tracks.size.should == 5
|
|
36
|
+
tracks[0]['name'].should == 'Stayin\' Alive'
|
|
37
|
+
tracks[0]['url'].should == 'http://www.last.fm/music/Bee+Gees/_/Stayin%27+Alive'
|
|
38
|
+
tracks[0]['artist']['name'].should == 'Bee Gees'
|
|
39
|
+
tracks[1]['name'].should == 'September'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
25
43
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lastfm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.16.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-02-
|
|
12
|
+
date: 2013-02-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: xml-simple
|
|
@@ -144,6 +144,7 @@ files:
|
|
|
144
144
|
- spec/fixtures/radio_get_playlist.xml
|
|
145
145
|
- spec/fixtures/radio_get_playlist_single_track.xml
|
|
146
146
|
- spec/fixtures/tag_get_top_artists.xml
|
|
147
|
+
- spec/fixtures/tag_get_top_tracks.xml
|
|
147
148
|
- spec/fixtures/tasteometer_compare.xml
|
|
148
149
|
- spec/fixtures/track_get_correction.xml
|
|
149
150
|
- spec/fixtures/track_get_info.xml
|
|
@@ -203,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
203
204
|
version: '0'
|
|
204
205
|
segments:
|
|
205
206
|
- 0
|
|
206
|
-
hash:
|
|
207
|
+
hash: 1260931291668534361
|
|
207
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
none: false
|
|
209
210
|
requirements:
|
|
@@ -212,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
212
213
|
version: '0'
|
|
213
214
|
segments:
|
|
214
215
|
- 0
|
|
215
|
-
hash:
|
|
216
|
+
hash: 1260931291668534361
|
|
216
217
|
requirements: []
|
|
217
218
|
rubyforge_project:
|
|
218
219
|
rubygems_version: 1.8.24
|
|
@@ -240,6 +241,7 @@ test_files:
|
|
|
240
241
|
- spec/fixtures/radio_get_playlist.xml
|
|
241
242
|
- spec/fixtures/radio_get_playlist_single_track.xml
|
|
242
243
|
- spec/fixtures/tag_get_top_artists.xml
|
|
244
|
+
- spec/fixtures/tag_get_top_tracks.xml
|
|
243
245
|
- spec/fixtures/tasteometer_compare.xml
|
|
244
246
|
- spec/fixtures/track_get_correction.xml
|
|
245
247
|
- spec/fixtures/track_get_info.xml
|