rockstar 0.8.0 → 0.8.1
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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/rockstar/artist.rb +4 -2
- data/rockstar.gemspec +5 -4
- data/test/fixtures/xml/artist/getinfo_artist_metalica_autocorrect_1.xml +145 -0
- data/test/unit/test_artist.rb +13 -7
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6186519263a6d2d658dff3c399cc5ad208c0d9d
|
4
|
+
data.tar.gz: 16d69efd0635bfd2ff02cb40d508dc78cd3e7293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67af4226ed392bdb79c6b4786c1b96b98ab0e18c2fe1170a5cee2b3fd1db60f03e46da7740ebca492482380b4e363fa75ca07598cc1531db99120ae7467e0103
|
7
|
+
data.tar.gz: ad18d45135e7b3be98bd2a2541dd53490c415e51b7fdf0e16946c0f9dc065cc11723a6acc37c7925e402506d1c61f97614473e2f26cd6a5323d2ae7160069c4b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rockstar [](https://next.travis-ci.org/putpat/rockstar)
|
1
|
+
# Rockstar [](https://next.travis-ci.org/putpat/rockstar) [](http://badge.fury.io/rb/rockstar)
|
2
2
|
|
3
3
|
Rockstar is a wrapper for the last.fm audioscrobbler web services (http://www.last.fm/api/). This gem is based on the scrobbler
|
4
4
|
gem by John Nunemaker and was updated to use the 2.0 version of the last.fm api
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
data/lib/rockstar/artist.rb
CHANGED
@@ -60,7 +60,7 @@ module Rockstar
|
|
60
60
|
class Artist < Base
|
61
61
|
attr_accessor :name, :mbid, :listenercount, :playcount, :rank, :url, :thumbnail
|
62
62
|
attr_accessor :summary, :content, :images, :count, :streamable, :tags
|
63
|
-
attr_accessor :chartposition
|
63
|
+
attr_accessor :chartposition, :autocorrect
|
64
64
|
|
65
65
|
# used for similar artists
|
66
66
|
attr_accessor :match
|
@@ -80,7 +80,8 @@ module Rockstar
|
|
80
80
|
def initialize(name, o={})
|
81
81
|
raise ArgumentError, "Name or mbid is required" if name.blank? && o[:mbid].blank?
|
82
82
|
@name = name unless name.blank?
|
83
|
-
@mbid = o
|
83
|
+
@mbid = o.fetch :mbid, nil
|
84
|
+
@autocorrect = o.fetch :autocorrect, nil
|
84
85
|
|
85
86
|
options = {:include_info => false}.merge(o)
|
86
87
|
load_info if options[:include_info]
|
@@ -89,6 +90,7 @@ module Rockstar
|
|
89
90
|
def load_info(xml=nil)
|
90
91
|
unless xml
|
91
92
|
params = @mbid.blank? ? {:artist => @name} : {:mbid => @mbid}
|
93
|
+
params.merge!(autocorrect: 1) if @autocorrect
|
92
94
|
|
93
95
|
doc = self.class.fetch_and_parse("artist.getInfo", params)
|
94
96
|
xml = (doc / :artist).first
|
data/rockstar.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: rockstar 0.8.
|
5
|
+
# stub: rockstar 0.8.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "rockstar"
|
9
|
-
s.version = "0.8.
|
9
|
+
s.version = "0.8.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Bodo Tasche"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-12-14"
|
15
15
|
s.description = "This gem is an updated version of jnunemakers scrobbler gem. Rockstar uses v2.0 of the last.fm api."
|
16
16
|
s.email = "bodo@putpat.tv"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
"test/fixtures/xml/artist/getevents_artist_Metallica.xml",
|
60
60
|
"test/fixtures/xml/artist/getimages_artist_Metallica_page_2.xml",
|
61
61
|
"test/fixtures/xml/artist/getinfo_artist_Metallica.xml",
|
62
|
+
"test/fixtures/xml/artist/getinfo_artist_metalica_autocorrect_1.xml",
|
62
63
|
"test/fixtures/xml/artist/getinfo_artist_slayer.xml",
|
63
64
|
"test/fixtures/xml/artist/getinfo_mbid_65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab.xml",
|
64
65
|
"test/fixtures/xml/artist/getsimilar_artist_Metallica.xml",
|
@@ -121,7 +122,7 @@ Gem::Specification.new do |s|
|
|
121
122
|
"test/unit/test_venue.rb"
|
122
123
|
]
|
123
124
|
s.homepage = "http://github.com/putpat/rockstar"
|
124
|
-
s.rubygems_version = "2.2.
|
125
|
+
s.rubygems_version = "2.2.2"
|
125
126
|
s.summary = "wrapper for audioscrobbler (last.fm) web services"
|
126
127
|
|
127
128
|
if s.respond_to? :specification_version then
|
@@ -0,0 +1,145 @@
|
|
1
|
+
<lfm status="ok">
|
2
|
+
<artist>
|
3
|
+
<name>Metallica</name>
|
4
|
+
<mbid>65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab</mbid>
|
5
|
+
<bandmembers>
|
6
|
+
<member>
|
7
|
+
<name>James Hetfield</name>
|
8
|
+
<yearfrom>1981</yearfrom>
|
9
|
+
</member>
|
10
|
+
<member>
|
11
|
+
<name>Lars Ulrich</name>
|
12
|
+
<yearfrom>1981</yearfrom>
|
13
|
+
</member>
|
14
|
+
<member>
|
15
|
+
<name>Kirk Hammett</name>
|
16
|
+
<yearfrom>1983</yearfrom>
|
17
|
+
</member>
|
18
|
+
<member>
|
19
|
+
<name>Robert Trujillo</name>
|
20
|
+
<yearfrom>2003</yearfrom>
|
21
|
+
</member>
|
22
|
+
</bandmembers>
|
23
|
+
<url>http://www.last.fm/music/Metallica</url>
|
24
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/3438692.jpg</image>
|
25
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/3438692.jpg</image>
|
26
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/3438692.jpg</image>
|
27
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/3438692.jpg</image>
|
28
|
+
<image size="mega">
|
29
|
+
http://userserve-ak.last.fm/serve/500/3438692/Metallica+band.jpg
|
30
|
+
</image>
|
31
|
+
<streamable>0</streamable>
|
32
|
+
<ontour>0</ontour>
|
33
|
+
<stats>
|
34
|
+
<listeners>2615890</listeners>
|
35
|
+
<playcount>240102218</playcount>
|
36
|
+
</stats>
|
37
|
+
<similar>
|
38
|
+
<artist>
|
39
|
+
<name>Megadeth</name>
|
40
|
+
<url>http://www.last.fm/music/Megadeth</url>
|
41
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/100238499.jpg</image>
|
42
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/100238499.jpg</image>
|
43
|
+
<image size="large">
|
44
|
+
http://userserve-ak.last.fm/serve/126/100238499.jpg
|
45
|
+
</image>
|
46
|
+
<image size="extralarge">
|
47
|
+
http://userserve-ak.last.fm/serve/252/100238499.jpg
|
48
|
+
</image>
|
49
|
+
<image size="mega">
|
50
|
+
http://userserve-ak.last.fm/serve/500/100238499/Megadeth+1604698_10152029114187330_5803.jpg
|
51
|
+
</image>
|
52
|
+
</artist>
|
53
|
+
<artist>
|
54
|
+
<name>Pantera</name>
|
55
|
+
<url>http://www.last.fm/music/Pantera</url>
|
56
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/29176179.jpg</image>
|
57
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/29176179.jpg</image>
|
58
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/29176179.jpg</image>
|
59
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/29176179.jpg</image>
|
60
|
+
<image size="mega">
|
61
|
+
http://userserve-ak.last.fm/serve/_/29176179/Pantera+6838373550px.jpg
|
62
|
+
</image>
|
63
|
+
</artist>
|
64
|
+
<artist>
|
65
|
+
<name>Slayer</name>
|
66
|
+
<url>http://www.last.fm/music/Slayer</url>
|
67
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/8428755.jpg</image>
|
68
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/8428755.jpg</image>
|
69
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/8428755.jpg</image>
|
70
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/8428755.jpg</image>
|
71
|
+
<image size="mega">
|
72
|
+
http://userserve-ak.last.fm/serve/500/8428755/Slayer.jpg
|
73
|
+
</image>
|
74
|
+
</artist>
|
75
|
+
<artist>
|
76
|
+
<name>Iron Maiden</name>
|
77
|
+
<url>http://www.last.fm/music/Iron+Maiden</url>
|
78
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/330947.jpg</image>
|
79
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/330947.jpg</image>
|
80
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/330947.jpg</image>
|
81
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/330947.jpg</image>
|
82
|
+
<image size="mega">
|
83
|
+
http://userserve-ak.last.fm/serve/500/330947/Iron+Maiden.jpg
|
84
|
+
</image>
|
85
|
+
</artist>
|
86
|
+
<artist>
|
87
|
+
<name>Lou Reed & Metallica</name>
|
88
|
+
<url>http://www.last.fm/music/Lou+Reed+&+Metallica</url>
|
89
|
+
<image size="small">http://userserve-ak.last.fm/serve/34/71171232.png</image>
|
90
|
+
<image size="medium">http://userserve-ak.last.fm/serve/64/71171232.png</image>
|
91
|
+
<image size="large">http://userserve-ak.last.fm/serve/126/71171232.png</image>
|
92
|
+
<image size="extralarge">http://userserve-ak.last.fm/serve/252/71171232.png</image>
|
93
|
+
<image size="mega">
|
94
|
+
http://userserve-ak.last.fm/serve/500/71171232/Lou+Reed++Metallica+loumet.png
|
95
|
+
</image>
|
96
|
+
</artist>
|
97
|
+
</similar>
|
98
|
+
<tags>
|
99
|
+
<tag>
|
100
|
+
<name>thrash metal</name>
|
101
|
+
<url>http://www.last.fm/tag/thrash%20metal</url>
|
102
|
+
</tag>
|
103
|
+
<tag>
|
104
|
+
<name>metal</name>
|
105
|
+
<url>http://www.last.fm/tag/metal</url>
|
106
|
+
</tag>
|
107
|
+
<tag>
|
108
|
+
<name>heavy metal</name>
|
109
|
+
<url>http://www.last.fm/tag/heavy%20metal</url>
|
110
|
+
</tag>
|
111
|
+
<tag>
|
112
|
+
<name>hard rock</name>
|
113
|
+
<url>http://www.last.fm/tag/hard%20rock</url>
|
114
|
+
</tag>
|
115
|
+
<tag>
|
116
|
+
<name>rock</name>
|
117
|
+
<url>http://www.last.fm/tag/rock</url>
|
118
|
+
</tag>
|
119
|
+
</tags>
|
120
|
+
<bio>
|
121
|
+
<links>
|
122
|
+
<link rel="original" href="http://www.last.fm/music/Metallica/+wiki"/>
|
123
|
+
</links>
|
124
|
+
<published>Tue, 13 May 2014 14:12:57 +0000</published>
|
125
|
+
<summary>
|
126
|
+
<![CDATA[
|
127
|
+
Metallica is an American metal band formed in 1981 in Los Angeles, California, United States when drummer Lars Ulrich posted an advertisement in The Recycler. Metallica’s line-up originally consisted of Ulrich, rhythm guitarist and vocalist James Hetfield, and lead guitarist Dave Mustaine. Mustaine was later fired due to problems with alcoholism and drug addiction - he went on to form the band Megadeth. Exodus guitarist Kirk Hammett took his place. <a href="http://www.last.fm/music/Metallica">Read more about Metallica on Last.fm</a>.
|
128
|
+
]]>
|
129
|
+
</summary>
|
130
|
+
<content>
|
131
|
+
<![CDATA[
|
132
|
+
Metallica is an American metal band formed in 1981 in Los Angeles, California, United States when drummer Lars Ulrich posted an advertisement in The Recycler. Metallica’s line-up originally consisted of Ulrich, rhythm guitarist and vocalist James Hetfield, and lead guitarist Dave Mustaine. Mustaine was later fired due to problems with alcoholism and drug addiction - he went on to form the band Megadeth. Exodus guitarist Kirk Hammett took his place. <a href="http://www.last.fm/music/Metallica">Read more about Metallica on Last.fm</a>. User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.
|
133
|
+
]]>
|
134
|
+
</content>
|
135
|
+
<placeformed>Los Angeles, California, United States</placeformed>
|
136
|
+
<yearformed>1981</yearformed>
|
137
|
+
<formationlist>
|
138
|
+
<formation>
|
139
|
+
<yearfrom>1981</yearfrom>
|
140
|
+
<yearto/>
|
141
|
+
</formation>
|
142
|
+
</formationlist>
|
143
|
+
</bio>
|
144
|
+
</artist>
|
145
|
+
</lfm>
|
data/test/unit/test_artist.rb
CHANGED
@@ -5,11 +5,11 @@ class TestArtist < Test::Unit::TestCase
|
|
5
5
|
def setup
|
6
6
|
@artist = Rockstar::Artist.new('Metallica')
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
test 'should require name' do
|
10
10
|
assert_raises(ArgumentError) { Rockstar::Artist.new('') }
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
test "should know it's name" do
|
14
14
|
assert_equal('Metallica', @artist.name)
|
15
15
|
end
|
@@ -53,7 +53,7 @@ class TestArtist < Test::Unit::TestCase
|
|
53
53
|
assert_equal('http://userserve-ak.last.fm/serve/126/598154.jpg', first.images['large'])
|
54
54
|
assert_equal('yes', first.streamable)
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
test 'should be able to find top fans' do
|
58
58
|
assert_equal(["yIIyIIyIIy", "eliteveritas", "BrandonUCD", "Mithrandir93"], @artist.top_fans.collect(&:username)[0..3])
|
59
59
|
first = @artist.top_fans.first
|
@@ -66,7 +66,7 @@ class TestArtist < Test::Unit::TestCase
|
|
66
66
|
assert_equal('http://userserve-ak.last.fm/serve/252/40197285.jpg', first.images['extralarge'])
|
67
67
|
assert_equal('707560000', first.weight)
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
test 'should be able to find top tracks' do
|
71
71
|
assert_equal(['Nothing Else Matters', 'Enter Sandman', 'One', 'Master Of Puppets'], @artist.top_tracks.collect(&:name)[0..3])
|
72
72
|
first = @artist.top_tracks.first
|
@@ -74,7 +74,7 @@ class TestArtist < Test::Unit::TestCase
|
|
74
74
|
assert_equal('', first.mbid)
|
75
75
|
assert_equal('http://www.last.fm/music/Metallica/_/Nothing+Else+Matters', first.url)
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
test 'should be able to find top albums' do
|
79
79
|
assert_equal(["Master Of Puppets", "Death Magnetic", "Ride The Lightning"], @artist.top_albums.collect(&:name)[0..2])
|
80
80
|
first = @artist.top_albums.first
|
@@ -83,9 +83,9 @@ class TestArtist < Test::Unit::TestCase
|
|
83
83
|
assert_equal('http://www.last.fm/music/Metallica/Master+Of+Puppets', first.url)
|
84
84
|
assert_equal('http://userserve-ak.last.fm/serve/34s/8622967.jpg', first.image(:small))
|
85
85
|
assert_equal('http://userserve-ak.last.fm/serve/64s/8622967.jpg', first.image(:medium))
|
86
|
-
assert_equal('http://userserve-ak.last.fm/serve/126/8622967.jpg', first.image(:large))
|
86
|
+
assert_equal('http://userserve-ak.last.fm/serve/126/8622967.jpg', first.image(:large))
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
test 'should be able to find top tags' do
|
90
90
|
assert_equal(['thrash metal', 'metal', 'heavy metal'], @artist.top_tags.collect(&:name)[0..2])
|
91
91
|
first = @artist.top_tags.first
|
@@ -120,4 +120,10 @@ class TestArtist < Test::Unit::TestCase
|
|
120
120
|
assert_equal("72de5171-38cf-4734-bc8a-6ac374dea523", artist.mbid)
|
121
121
|
assert_match(/Slayer's musical traits involve fast tremolo picking/, artist.summary)
|
122
122
|
end
|
123
|
+
|
124
|
+
test 'should be able to correct artist name' do
|
125
|
+
artist = Rockstar::Artist.new('metalica', :include_info => true, autocorrect: true)
|
126
|
+
assert_equal("Metallica", artist.name)
|
127
|
+
assert_equal("http://www.last.fm/music/Metallica", artist.url)
|
128
|
+
end
|
123
129
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rockstar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bodo Tasche
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- test/fixtures/xml/artist/getevents_artist_Metallica.xml
|
130
130
|
- test/fixtures/xml/artist/getimages_artist_Metallica_page_2.xml
|
131
131
|
- test/fixtures/xml/artist/getinfo_artist_Metallica.xml
|
132
|
+
- test/fixtures/xml/artist/getinfo_artist_metalica_autocorrect_1.xml
|
132
133
|
- test/fixtures/xml/artist/getinfo_artist_slayer.xml
|
133
134
|
- test/fixtures/xml/artist/getinfo_mbid_65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab.xml
|
134
135
|
- test/fixtures/xml/artist/getsimilar_artist_Metallica.xml
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
version: '0'
|
209
210
|
requirements: []
|
210
211
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.2.
|
212
|
+
rubygems_version: 2.2.2
|
212
213
|
signing_key:
|
213
214
|
specification_version: 4
|
214
215
|
summary: wrapper for audioscrobbler (last.fm) web services
|