rockstar 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -3
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/rockstar.rb +1 -0
- data/lib/rockstar/library.rb +13 -0
- data/lib/rockstar/track.rb +3 -1
- data/lib/rockstar/user.rb +22 -1
- data/rockstar.gemspec +16 -10
- data/test/fixtures/xml/library/getalbums_user_jnunemaker.xml +704 -0
- data/test/fixtures/xml/library/getartists_user_jnunemaker.xml +554 -0
- data/test/fixtures/xml/track/getinfo_artist_Carrie_Underwood_track_Before_He_Cheats.xml +1 -1
- data/test/fixtures/xml/track/getinfo_artist_Karrie_Underwood_track_Before_He_Cheats.xml +55 -0
- data/test/unit/test_library.rb +65 -0
- data/test/unit/test_track.rb +4 -0
- metadata +113 -77
@@ -0,0 +1,55 @@
|
|
1
|
+
<lfm status="ok">
|
2
|
+
<track nowplaying="true">
|
3
|
+
<id>31391366</id>
|
4
|
+
<name>Before He Cheats</name>
|
5
|
+
<mbid></mbid>
|
6
|
+
<url>http://www.last.fm/music/Carrie+Underwood/_/Before+He+Cheats</url>
|
7
|
+
<duration>198000</duration>
|
8
|
+
<streamable fulltrack="0">1</streamable>
|
9
|
+
<listeners>186271</listeners>
|
10
|
+
<playcount>1040848</playcount>
|
11
|
+
<artist>
|
12
|
+
<name>Carrie Underwood</name>
|
13
|
+
<mbid>70f0e309-5418-49b6-a130-666e2f76eecd</mbid>
|
14
|
+
<url>http://www.last.fm/music/Carrie+Underwood</url>
|
15
|
+
</artist>
|
16
|
+
<album position="7">
|
17
|
+
<artist>Carrie Underwood</artist>
|
18
|
+
<title>Some Hearts</title>
|
19
|
+
<mbid>a33b9822-9f09-4e19-9d6e-e05af85c727b</mbid>
|
20
|
+
<url>http://www.last.fm/music/Carrie+Underwood/Some+Hearts</url>
|
21
|
+
<image size="small">http://userserve-ak.last.fm/serve/64s/56864167.png</image>
|
22
|
+
<image size="medium">http://userserve-ak.last.fm/serve/126/56864167.png</image>
|
23
|
+
<image size="large">http://userserve-ak.last.fm/serve/174s/56864167.png</image>
|
24
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/56864167.png</image>
|
25
|
+
</album>
|
26
|
+
<toptags>
|
27
|
+
<tag>
|
28
|
+
<name>country</name>
|
29
|
+
<url>http://www.last.fm/tag/country</url>
|
30
|
+
</tag>
|
31
|
+
<tag>
|
32
|
+
<name>carrie underwood</name>
|
33
|
+
<url>http://www.last.fm/tag/carrie%20underwood</url>
|
34
|
+
</tag>
|
35
|
+
<tag>
|
36
|
+
<name>female vocalists</name>
|
37
|
+
<url>http://www.last.fm/tag/female%20vocalists</url>
|
38
|
+
</tag>
|
39
|
+
<tag>
|
40
|
+
<name>pop</name>
|
41
|
+
<url>http://www.last.fm/tag/pop</url>
|
42
|
+
</tag>
|
43
|
+
<tag>
|
44
|
+
<name>american idol</name>
|
45
|
+
<url>http://www.last.fm/tag/american%20idol</url>
|
46
|
+
</tag>
|
47
|
+
</toptags>
|
48
|
+
<wiki>
|
49
|
+
<published>Fri, 14 Jan 2011 21:46:49 +0000</published>
|
50
|
+
<summary><![CDATA["Before He Cheats" is a song written by Chris Tompkins and Josh Kear and the third wide-release single from Carrie Underwood's debut album, Some Hearts. It was the fifth release from the album overall. It was named the 2007 Single of the Year by the Country Music Association. It is Underwood's most successful single to date, with sales of over 3.1 million digital downloads. It is the second most sold single from an American Idol contestant, ("No Air" by season 6 winner Jordin Sparks being the first) and the fourth longest-charting single in the history of the Hot 100.]]></summary>
|
51
|
+
<content><![CDATA["Before He Cheats" is a song written by Chris Tompkins and Josh Kear and the third wide-release single from Carrie Underwood's debut album, Some Hearts. It was the fifth release from the album overall. It was named the 2007 Single of the Year by the Country Music Association. It is Underwood's most successful single to date, with sales of over 3.1 million digital downloads. It is the second most sold single from an American Idol contestant, ("No Air" by season 6 winner Jordin Sparks being the first) and the fourth longest-charting single in the history of the Hot 100.
|
52
|
+
|
53
|
+
User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.]]></content>
|
54
|
+
</wiki>
|
55
|
+
</track></lfm>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../../test_helper.rb', __FILE__)
|
3
|
+
|
4
|
+
class TestLibrary < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@library = Rockstar::Library.new
|
8
|
+
@user = Rockstar::User.new('jnunemaker')
|
9
|
+
end
|
10
|
+
|
11
|
+
test "should be able to get a user's library artists" do
|
12
|
+
assert_equal(50, @library.artists(false, { :user => @user.username }).size)
|
13
|
+
first = @library.artists(false, { :user => @user.username }).first
|
14
|
+
assert_equal('Taylor Swift', first.name)
|
15
|
+
assert_equal('20244d07-534f-4eff-b4d4-930878889970', first.mbid)
|
16
|
+
assert_equal('1392', first.playcount)
|
17
|
+
assert_equal('1', first.rank)
|
18
|
+
assert_equal('http://www.last.fm/music/Taylor+Swift', first.url)
|
19
|
+
assert_equal('http://userserve-ak.last.fm/serve/34/30883349.png', first.thumbnail)
|
20
|
+
assert_equal('http://userserve-ak.last.fm/serve/64/30883349.png', first.image)
|
21
|
+
end
|
22
|
+
|
23
|
+
test "should be able to get a user's library artists via wrapper" do
|
24
|
+
assert_equal(50, @user.artists.size)
|
25
|
+
first = @user.artists.first
|
26
|
+
assert_equal('Taylor Swift', first.name)
|
27
|
+
assert_equal('20244d07-534f-4eff-b4d4-930878889970', first.mbid)
|
28
|
+
assert_equal('1392', first.playcount)
|
29
|
+
assert_equal('1', first.rank)
|
30
|
+
assert_equal('http://www.last.fm/music/Taylor+Swift', first.url)
|
31
|
+
assert_equal('http://userserve-ak.last.fm/serve/34/30883349.png', first.thumbnail)
|
32
|
+
assert_equal('http://userserve-ak.last.fm/serve/64/30883349.png', first.image)
|
33
|
+
end
|
34
|
+
|
35
|
+
test "should be able to get a user's library albums" do
|
36
|
+
assert_equal(50, @library.albums(false, { :user => @user.username }).size)
|
37
|
+
first = @library.albums(false, { :user => @user.username }).first
|
38
|
+
assert_equal('Dwight Yoakam', first.artist)
|
39
|
+
assert_equal('0fb711af-c7ba-4bdc-b0b6-b8495fc0a590', first.artist_mbid)
|
40
|
+
assert_equal('The Very Best of Dwight Yoakam', first.name)
|
41
|
+
assert_equal('b6a051b4-1a1e-4c33-a1e5-0ea6e920a13f', first.mbid)
|
42
|
+
assert_equal('560', first.playcount)
|
43
|
+
assert_equal('1', first.rank)
|
44
|
+
assert_equal('http://www.last.fm/music/Dwight+Yoakam/The+Very+Best+of+Dwight+Yoakam', first.url)
|
45
|
+
assert_equal('http://userserve-ak.last.fm/serve/34s/8725405.jpg', first.image(:small))
|
46
|
+
assert_equal('http://userserve-ak.last.fm/serve/64s/8725405.jpg', first.image(:medium))
|
47
|
+
assert_equal('http://userserve-ak.last.fm/serve/126/8725405.jpg', first.image(:large))
|
48
|
+
end
|
49
|
+
|
50
|
+
test "should be able to get a user's library albums via wrapper" do
|
51
|
+
assert_equal(50, @user.albums.size)
|
52
|
+
first = @user.albums.first
|
53
|
+
assert_equal('Dwight Yoakam', first.artist)
|
54
|
+
assert_equal('0fb711af-c7ba-4bdc-b0b6-b8495fc0a590', first.artist_mbid)
|
55
|
+
assert_equal('The Very Best of Dwight Yoakam', first.name)
|
56
|
+
assert_equal('b6a051b4-1a1e-4c33-a1e5-0ea6e920a13f', first.mbid)
|
57
|
+
assert_equal('560', first.playcount)
|
58
|
+
assert_equal('1', first.rank)
|
59
|
+
assert_equal('http://www.last.fm/music/Dwight+Yoakam/The+Very+Best+of+Dwight+Yoakam', first.url)
|
60
|
+
assert_equal('http://userserve-ak.last.fm/serve/34s/8725405.jpg', first.image(:small))
|
61
|
+
assert_equal('http://userserve-ak.last.fm/serve/64s/8725405.jpg', first.image(:medium))
|
62
|
+
assert_equal('http://userserve-ak.last.fm/serve/126/8725405.jpg', first.image(:large))
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
data/test/unit/test_track.rb
CHANGED
@@ -4,6 +4,7 @@ class TestTrack < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def setup
|
6
6
|
@track = Rockstar::Track.new('Carrie Underwood', 'Before He Cheats')
|
7
|
+
@track1 = Rockstar::Track.new('Karrie Underwood', 'Before He Cheats')
|
7
8
|
end
|
8
9
|
|
9
10
|
test 'should require the artist name' do
|
@@ -24,8 +25,11 @@ class TestTrack < Test::Unit::TestCase
|
|
24
25
|
|
25
26
|
test 'should be able to load track info' do
|
26
27
|
@track.load_info
|
28
|
+
@track1.load_info
|
27
29
|
assert_equal('http://www.last.fm/music/Carrie+Underwood/_/Before+He+Cheats', @track.url)
|
28
30
|
assert_equal('1040848', @track.playcount)
|
31
|
+
assert_equal(false, @track.now_playing?)
|
32
|
+
assert_equal(true, @track1.now_playing?)
|
29
33
|
assert_match(/named the 2007 Single of the Year by the Country Music Association/, @track.summary)
|
30
34
|
end
|
31
35
|
|
metadata
CHANGED
@@ -1,103 +1,136 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rockstar
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.6.4
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Bodo Tasche
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: rake
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
27
31
|
name: hpricot
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
33
37
|
version: 0.4.86
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.86
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
name: i18n
|
39
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
40
49
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version:
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
45
54
|
type: :runtime
|
46
55
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
49
63
|
name: activesupport
|
50
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
51
65
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
55
69
|
version: 1.4.2
|
56
70
|
type: :runtime
|
57
71
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.4.2
|
78
|
+
- !ruby/object:Gem::Dependency
|
60
79
|
name: jeweler
|
61
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
62
81
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version:
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
67
86
|
type: :development
|
68
87
|
prerelease: false
|
69
|
-
version_requirements:
|
70
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
71
95
|
name: hpricot
|
72
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
73
97
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
77
101
|
version: 0.4.86
|
78
102
|
type: :runtime
|
79
103
|
prerelease: false
|
80
|
-
version_requirements:
|
81
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.4.86
|
110
|
+
- !ruby/object:Gem::Dependency
|
82
111
|
name: activesupport
|
83
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
84
113
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
88
117
|
version: 1.4.2
|
89
118
|
type: :runtime
|
90
119
|
prerelease: false
|
91
|
-
version_requirements:
|
92
|
-
|
93
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.4.2
|
126
|
+
description: This gem is an updated version of jnunemakers scrobbler gem. Rockstar
|
127
|
+
uses v2.0 of the last.fm api.
|
128
|
+
email: bodo@putpat.tv
|
94
129
|
executables: []
|
95
|
-
|
96
130
|
extensions: []
|
97
|
-
|
98
|
-
extra_rdoc_files:
|
131
|
+
extra_rdoc_files:
|
99
132
|
- README.md
|
100
|
-
files:
|
133
|
+
files:
|
101
134
|
- .travis.yml
|
102
135
|
- Gemfile
|
103
136
|
- Gemfile.lock
|
@@ -124,6 +157,7 @@ files:
|
|
124
157
|
- lib/rockstar/chart.rb
|
125
158
|
- lib/rockstar/event.rb
|
126
159
|
- lib/rockstar/geo.rb
|
160
|
+
- lib/rockstar/library.rb
|
127
161
|
- lib/rockstar/metro.rb
|
128
162
|
- lib/rockstar/rest.rb
|
129
163
|
- lib/rockstar/session.rb
|
@@ -146,11 +180,14 @@ files:
|
|
146
180
|
- test/fixtures/xml/artist/gettoptracks_artist_Metallica.xml
|
147
181
|
- test/fixtures/xml/geo/getevents_location_london.xml
|
148
182
|
- test/fixtures/xml/geo/getmetros_country_germany.xml
|
183
|
+
- test/fixtures/xml/library/getalbums_user_jnunemaker.xml
|
184
|
+
- test/fixtures/xml/library/getartists_user_jnunemaker.xml
|
149
185
|
- test/fixtures/xml/tag/gettopalbums_tag_rock.xml
|
150
186
|
- test/fixtures/xml/tag/gettopartists_tag_rock.xml
|
151
187
|
- test/fixtures/xml/tag/gettoptags.xml
|
152
188
|
- test/fixtures/xml/tag/gettoptracks_tag_rock.xml
|
153
189
|
- test/fixtures/xml/track/getinfo_artist_Carrie_Underwood_track_Before_He_Cheats.xml
|
190
|
+
- test/fixtures/xml/track/getinfo_artist_Karrie_Underwood_track_Before_He_Cheats.xml
|
154
191
|
- test/fixtures/xml/track/getsimilar_artist_Carrie_Underwood_limit_10_track_Before_He_Cheats.xml
|
155
192
|
- test/fixtures/xml/track/gettopfans_artist_Carrie_Underwood_track_Before_He_Cheats.xml
|
156
193
|
- test/fixtures/xml/track/gettoptags_artist_Carrie_Underwood_track_Before_He_Cheats.xml
|
@@ -186,42 +223,40 @@ files:
|
|
186
223
|
- test/unit/test_artist.rb
|
187
224
|
- test/unit/test_chart.rb
|
188
225
|
- test/unit/test_geo.rb
|
226
|
+
- test/unit/test_library.rb
|
189
227
|
- test/unit/test_rockstar.rb
|
190
228
|
- test/unit/test_tag.rb
|
191
229
|
- test/unit/test_track.rb
|
192
230
|
- test/unit/test_user.rb
|
193
231
|
- test/unit/test_venue.rb
|
194
|
-
homepage: http://github.com/
|
232
|
+
homepage: http://github.com/putpat/rockstar
|
195
233
|
licenses: []
|
196
|
-
|
197
234
|
post_install_message:
|
198
235
|
rdoc_options: []
|
199
|
-
|
200
|
-
require_paths:
|
236
|
+
require_paths:
|
201
237
|
- lib
|
202
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
238
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
203
239
|
none: false
|
204
|
-
requirements:
|
205
|
-
- -
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
|
208
|
-
segments:
|
240
|
+
requirements:
|
241
|
+
- - ! '>='
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
segments:
|
209
245
|
- 0
|
210
|
-
|
211
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
|
+
hash: -2360455835934116520
|
247
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
248
|
none: false
|
213
|
-
requirements:
|
214
|
-
- -
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version:
|
249
|
+
requirements:
|
250
|
+
- - ! '>='
|
251
|
+
- !ruby/object:Gem::Version
|
252
|
+
version: '0'
|
217
253
|
requirements: []
|
218
|
-
|
219
254
|
rubyforge_project:
|
220
|
-
rubygems_version: 1.8.
|
255
|
+
rubygems_version: 1.8.23
|
221
256
|
signing_key:
|
222
257
|
specification_version: 3
|
223
258
|
summary: wrapper for audioscrobbler (last.fm) web services
|
224
|
-
test_files:
|
259
|
+
test_files:
|
225
260
|
- examples/album.rb
|
226
261
|
- examples/artist.rb
|
227
262
|
- examples/geo.rb
|
@@ -235,6 +270,7 @@ test_files:
|
|
235
270
|
- test/unit/test_artist.rb
|
236
271
|
- test/unit/test_chart.rb
|
237
272
|
- test/unit/test_geo.rb
|
273
|
+
- test/unit/test_library.rb
|
238
274
|
- test/unit/test_rockstar.rb
|
239
275
|
- test/unit/test_tag.rb
|
240
276
|
- test/unit/test_track.rb
|