rockstar 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -33,64 +33,63 @@ module Rockstar
33
33
  def new_from_xml(xml, doc=nil)
34
34
  name = (xml).at(:name).inner_html if (xml).at(:name)
35
35
  name = xml['name'] if name.nil? && xml['name']
36
+ name = xml.at(:title).inner_html if name.nil? && (xml).at(:title)
36
37
  artist = (xml).at(:artist).at(:name).inner_html if (xml).at(:artist) && (xml).at(:artist).at(:name)
37
38
  artist = (xml).at(:artist).inner_html if artist.nil? && (xml).at(:artist)
38
39
  artist = doc.root['artist'] if artist.nil? && doc.root['artist']
39
- a = Album.new(artist, name)
40
- a.artist_mbid = (xml).at(:artist)['mbid'] if (xml).at(:artist) && (xml).at(:artist)['mbid']
41
- a.artist_mbid = (xml).at(:artist).at(:mbid).inner_html if a.artist_mbid.nil? && (xml).at(:artist) && (xml).at(:artist).at(:mbid)
42
- a.mbid = (xml).at(:mbid).inner_html if (xml).at(:mbid)
43
- a.playcount = (xml).at(:playcount).inner_html if (xml).at(:playcount)
44
- a.rank = xml['rank'] if xml['rank']
45
- a.rank = (xml).at(:rank).inner_html if (xml).at(:rank) if a.rank.nil?
46
- a.url = Base.fix_url((xml).at(:url).inner_html) if (xml).at(:url)
47
-
48
- a.chartposition = a.rank
49
-
50
- a.images = {}
51
- (xml/'image').each {|image|
52
- a.images[image['size']] = image.inner_html
53
- }
54
-
55
- a.image_large = a.images['large']
56
- a.image_medium = a.images['medium']
57
- a.image_small = a.images['small']
58
-
59
- # needed on top albums for tag
60
- a.count = xml['count'] if xml['count']
61
- a.streamable = xml['streamable'] if xml['streamable']
62
- a
40
+
41
+ album = Album.new(artist, name)
42
+ album.load_info(xml)
43
+ album
63
44
  end
64
45
  end
65
-
46
+
66
47
  def initialize(artist, name, o={})
67
48
  raise ArgumentError, "Artist is required" if artist.blank?
68
49
  raise ArgumentError, "Name is required" if name.blank?
69
50
  @artist = artist
70
51
  @name = name
52
+
71
53
  options = {:include_info => false}.merge(o)
72
- load_info() if options[:include_info]
54
+ load_info if options[:include_info]
73
55
  end
74
56
 
75
- def load_info
76
- doc = self.class.fetch_and_parse("album.getInfo", {:artist => @artist, :album =>@name})
77
- @url = Base.fix_url((doc).at(:url).inner_html)
78
- @release_date = Base.parse_time((doc).at(:releasedate).inner_html.strip)
57
+ def load_info(xml=nil)
58
+ unless xml
59
+ doc = self.class.fetch_and_parse("album.getInfo", {:artist => @artist, :album =>@name})
60
+ xml = (doc / :album).first
61
+ end
62
+
63
+ self.artist_mbid = (xml).at(:artist)['mbid'] if (xml).at(:artist) && (xml).at(:artist)['mbid']
64
+ self.artist_mbid = (xml).at(:artist).at(:mbid).inner_html if artist_mbid.nil? && (xml).at(:artist) && (xml).at(:artist).at(:mbid)
65
+ self.mbid = (xml).at(:mbid).inner_html if (xml).at(:mbid)
66
+ self.playcount = (xml).at(:playcount).inner_html if (xml).at(:playcount)
67
+ self.rank = xml['rank'] if xml['rank']
68
+ self.rank = (xml).at(:rank).inner_html if (xml).at(:rank) if rank.nil?
69
+ self.url = Base.fix_url((xml).at(:url).inner_html) if (xml).at(:url)
79
70
 
80
- @images = {}
81
- (doc/'image').each {|image|
82
- @images[image['size']] = image.inner_html
83
- }
71
+ self.summary = (xml).at(:summary).to_plain_text if (xml).at(:summary)
72
+ self.content = (xml).at(:content).to_plain_text if (xml).at(:content)
84
73
 
85
- @image_large = @images['large']
86
- @image_medium = @images['medium']
87
- @image_small = @images['small']
74
+ self.release_date = Base.parse_time((xml).at(:releasedate).inner_html.strip) if (xml).at(:releasedate)
75
+ self.chartposition = rank
76
+
77
+ self.images = {}
78
+ (xml/'image').each {|image|
79
+ self.images[image['size']] = image.inner_html
80
+ }
81
+
82
+ self.image_large = images['large']
83
+ self.image_medium = images['medium']
84
+ self.image_small = images['small']
85
+
86
+ # needed on top albums for tag
87
+ self.count = xml['count'] if xml['count']
88
+ self.streamable = xml['streamable'] if xml['streamable']
88
89
 
89
- @mbid = (doc).at(:mbid).inner_html
90
- @summary = (doc).at(:summary).to_plain_text if (doc).at(:summary)
91
- @content = (doc).at(:content).to_plain_text if (doc).at(:content)
90
+ self
92
91
  end
93
-
92
+
94
93
  def tracks
95
94
  warn "[DEPRECATION] `tracks` is deprecated. The current api doesn't offer this function"
96
95
  []
@@ -66,36 +66,51 @@ module Rockstar
66
66
 
67
67
  class << self
68
68
  def new_from_xml(xml, doc=nil)
69
- name = (xml).at(:name).inner_html if (xml).at(:name)
70
69
  # occasionally name can be found in root of artist element (<artist name="">) rather than as an element (<name>)
70
+ name = (xml).at(:name).inner_html if (xml).at(:name)
71
71
  name = xml['name'] if name.nil? && xml['name']
72
- a = Artist.new(name)
73
- a.mbid = (xml).at(:mbid).inner_html if (xml).at(:mbid)
74
- a.playcount = (xml).at(:playcount).inner_html if (xml).at(:playcount)
75
- a.chartposition = a.rank = xml['rank'] if xml['rank']
76
- a.chartposition = a.rank = (xml).at(:rank).inner_html if (xml).at(:rank) if a.rank.nil?
77
- a.url = Base.fix_url((xml).at(:url).inner_html) if (xml).at(:url)
78
-
79
- a.images = {}
80
- (xml/'image').each {|image|
81
- a.images[image['size']] = image.inner_html
82
- }
83
-
84
- a.thumbnail = a.images['small']
85
-
86
- a.match = (xml).at(:match).inner_html if (xml).at(:match)
87
-
88
- # in top artists for tag
89
- a.count = xml['count'] if xml['count']
90
- a.streamable = xml['streamable'] if xml['streamable']
91
- a.streamable = (xml).at(:streamable).inner_html == '1' ? 'yes' : 'no' if a.streamable.nil? && (xml).at(:streamable)
92
- a
72
+
73
+ artist = Artist.new(name)
74
+ artist.load_info(xml)
75
+ artist
93
76
  end
94
77
  end
95
78
 
96
- def initialize(name)
79
+ def initialize(name, o={})
97
80
  raise ArgumentError, "Name is required" if name.blank?
98
81
  @name = name
82
+
83
+ options = {:include_info => false}.merge(o)
84
+ load_info if options[:include_info]
85
+ end
86
+
87
+ def load_info(xml=nil)
88
+ unless xml
89
+ doc = self.class.fetch_and_parse("artist.getInfo", {:artist => @name})
90
+ xml = (doc / :artist).first
91
+ end
92
+
93
+ self.mbid = (xml).at(:mbid).inner_html if (xml).at(:mbid)
94
+ self.playcount = (xml).at(:playcount).inner_html if (xml).at(:playcount)
95
+ self.chartposition = self.rank = xml['rank'] if xml['rank']
96
+ self.chartposition = self.rank = (xml).at(:rank).inner_html if (xml).at(:rank) if self.rank.nil?
97
+ self.url = Base.fix_url((xml).at(:url).inner_html) if (xml).at(:url)
98
+
99
+ self.images = {}
100
+ (xml/'image').each {|image|
101
+ self.images[image['size']] = image.inner_html
102
+ }
103
+
104
+ self.thumbnail = self.images['small']
105
+ self.match = (xml).at(:match).inner_html if (xml).at(:match)
106
+
107
+ # in top artists for tag
108
+ self.count = xml['count'] if xml['count']
109
+ self.streamable = xml['streamable'] if xml['streamable']
110
+
111
+ self.streamable = (xml).at(:streamable).inner_html == '1' ? 'yes' : 'no' if self.streamable.nil? && (xml).at(:streamable)
112
+
113
+ self
99
114
  end
100
115
 
101
116
  def current_events(format=:ics)
@@ -122,7 +137,7 @@ module Rockstar
122
137
  def top_tags(force=false)
123
138
  get_instance("artist.getTopTags", :top_tags, :tag, {:artist => @name}, force)
124
139
  end
125
-
140
+
126
141
  def image(which=:medium)
127
142
  which = which.to_s
128
143
  raise ArgumentError unless ['small', 'medium', 'large', 'extralarge'].include?(which)
@@ -58,30 +58,10 @@ module Rockstar
58
58
  artist = doc.root['artist'] if artist.nil? && doc.root['artist']
59
59
  name = (xml).at(:name).inner_html if (xml).at(:name)
60
60
  name = xml['name'] if name.nil? && xml['name']
61
- t = Track.new(artist, name)
62
- t.artist_mbid = (xml).at(:artist)['mbid'] if (xml).at(:artist) && (xml).at(:artist)['mbid']
63
- t.artist_mbid = (xml).at(:artist).at(:mbid).inner_html if t.artist_mbid.nil? && (xml).at(:artist) && (xml).at(:artist).at(:mbid)
64
- t.mbid = (xml).at(:mbid).inner_html if (xml).at(:mbid)
65
- t.playcount = (xml).at(:playcount).inner_html if (xml).at(:playcount)
66
- t.chartposition = t.rank = xml['rank'] if xml['rank']
67
- t.url = Base.fix_url((xml).at(:url).inner_html) if (xml).at(:url)
68
- t.streamable = (xml).at(:track)['streamable'] if (xml).at(:track) && (xml).at(:track)['streamable']
69
- t.streamable = (xml).at(:streamable).inner_html == '1' ? 'yes' : 'no' if t.streamable.nil? && (xml).at(:streamable)
70
-
71
- t.count = xml['count'] if xml['count']
72
- t.album = (xml).at(:album).inner_html if (xml).at(:album)
73
- t.album_mbid = (xml).at(:album)['mbid'] if (xml).at(:album) && (xml).at(:album)['mbid']
74
- t.date = Base.parse_time((xml).at(:date).inner_html) if (xml).at(:date)
75
- t.date_uts = (xml).at(:date)['uts'] if (xml).at(:date) && (xml).at(:date)['uts']
76
-
77
- t.images = {}
78
- (xml/'image').each {|image|
79
- t.images[image['size']] = image.inner_html
80
- }
81
-
82
- t.thumbnail = t.images['small']
83
- t.image = t.images['medium']
84
- t
61
+
62
+ track = Track.new(artist, name)
63
+ track.load_info(xml)
64
+ track
85
65
  end
86
66
 
87
67
  def love(artist, track, session_key)
@@ -181,11 +161,50 @@ module Rockstar
181
161
 
182
162
  end
183
163
 
184
- def initialize(artist, name)
164
+ def initialize(artist, name, o={})
185
165
  raise ArgumentError, "Artist is required" if artist.blank?
186
166
  raise ArgumentError, "Name is required" if name.blank?
187
167
  @artist = artist
188
168
  @name = name
169
+
170
+ options = {:include_info => false}.merge(o)
171
+ load_info if options[:include_info]
172
+ end
173
+
174
+ def load_info(xml=nil)
175
+ unless xml
176
+ doc = self.class.fetch_and_parse("track.getInfo", {:artist => @artist, :track => @name})
177
+ xml = (doc / :track).first
178
+ end
179
+
180
+ self.artist_mbid = (xml).at(:artist)['mbid'] if (xml).at(:artist) && (xml).at(:artist)['mbid']
181
+ self.artist_mbid = (xml).at(:artist).at(:mbid).inner_html if artist_mbid.nil? && (xml).at(:artist) && (xml).at(:artist).at(:mbid)
182
+ self.mbid = (xml).at(:mbid).inner_html if (xml).at(:mbid)
183
+ self.playcount = (xml).at(:playcount).inner_html if (xml).at(:playcount)
184
+ self.chartposition = self.rank = xml['rank'] if xml['rank']
185
+ self.url = Base.fix_url((xml).at(:url).inner_html) if (xml).at(:url)
186
+ self.streamable = (xml).at(:track)['streamable'] if (xml).at(:track) && (xml).at(:track)['streamable']
187
+ self.streamable = (xml).at(:streamable).inner_html == '1' ? 'yes' : 'no' if streamable.nil? && (xml).at(:streamable)
188
+
189
+ self.count = xml['count'] if xml['count']
190
+ self.album = (xml).at(:album).inner_html if (xml).at(:album)
191
+ self.album_mbid = (xml).at(:album)['mbid'] if (xml).at(:album) && (xml).at(:album)['mbid']
192
+ self.date = Base.parse_time((xml).at(:date).inner_html) if (xml).at(:date)
193
+ self.date_uts = (xml).at(:date)['uts'] if (xml).at(:date) && (xml).at(:date)['uts']
194
+
195
+ self.images = {}
196
+ (xml/'image').each {|image|
197
+ self.images[image['size']] = image.inner_html
198
+ }
199
+
200
+ self.thumbnail = images['small']
201
+ self.image = images['medium']
202
+
203
+ self
204
+ end
205
+
206
+ def albums(force=false)
207
+ get_instance("track.getInfo", :album, :album, {:track => @name, :artist => @artist}, force)
189
208
  end
190
209
 
191
210
  def fans(force=false)
data/rockstar.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rockstar}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bodo Tasche"]
12
- s.date = %q{2011-02-20}
12
+ s.date = %q{2011-04-03}
13
13
  s.description = %q{This gem is an updated version of jnunemakers scrobbler gem. Rockstar uses v2.0 of the last.fm api.}
14
14
  s.email = %q{bodo@bitboxer.de}
15
15
  s.extra_rdoc_files = [
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  "rockstar.gemspec",
55
55
  "test/fixtures/xml/album/getinfo_album_Radio_Retalation_artist_Thievery_Corporation.xml",
56
56
  "test/fixtures/xml/album/getinfo_album_Some_Hearts_artist_Carrie_Underwood.xml",
57
+ "test/fixtures/xml/artist/getinfo_artist_Metallica.xml",
57
58
  "test/fixtures/xml/artist/getsimilar_artist_Metallica.xml",
58
59
  "test/fixtures/xml/artist/gettopalbums_artist_Metallica.xml",
59
60
  "test/fixtures/xml/artist/gettopfans_artist_Metallica.xml",
@@ -65,6 +66,7 @@ Gem::Specification.new do |s|
65
66
  "test/fixtures/xml/tag/gettopartists_tag_rock.xml",
66
67
  "test/fixtures/xml/tag/gettoptags.xml",
67
68
  "test/fixtures/xml/tag/gettoptracks_tag_rock.xml",
69
+ "test/fixtures/xml/track/getinfo_artist_Carrie_Underwood_track_Before_He_Cheats.xml",
68
70
  "test/fixtures/xml/track/gettopfans_artist_Carrie_Underwood_track_Before_He_Cheats.xml",
69
71
  "test/fixtures/xml/track/gettoptags_artist_Carrie_Underwood_track_Before_He_Cheats.xml",
70
72
  "test/fixtures/xml/track/love_artist_Carrie_Underwood_sk_tag_track_Before_He_Cheats.xml",
@@ -108,7 +110,7 @@ Gem::Specification.new do |s|
108
110
  ]
109
111
  s.homepage = %q{http://github.com/bitboxer/rockstar}
110
112
  s.require_paths = ["lib"]
111
- s.rubygems_version = %q{1.5.2}
113
+ s.rubygems_version = %q{1.6.1}
112
114
  s.summary = %q{wrapper for audioscrobbler (last.fm) web services}
113
115
  s.test_files = [
114
116
  "examples/album.rb",
@@ -0,0 +1,115 @@
1
+ <lfm status="ok">
2
+ <artist>
3
+ <name>Metallica</name>
4
+ <mbid>65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab</mbid>
5
+ <url>http://www.last.fm/music/Metallica</url>
6
+ <image size="small">http://userserve-ak.last.fm/serve/34/3679639.jpg</image>
7
+ <image size="medium">http://userserve-ak.last.fm/serve/64/3679639.jpg</image>
8
+ <image size="large">http://userserve-ak.last.fm/serve/126/3679639.jpg</image>
9
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/3679639.jpg</image>
10
+ <image size="mega">http://userserve-ak.last.fm/serve/_/3679639/Metallica+++Jason.jpg</image>
11
+ <streamable>1</streamable>
12
+ <stats>
13
+ <listeners>1873516</listeners>
14
+ <playcount>160744699</playcount>
15
+ </stats>
16
+
17
+ <similar>
18
+ <artist>
19
+ <name>Megadeth</name>
20
+ <url>http://www.last.fm/music/Megadeth</url>
21
+ <image size="small">http://userserve-ak.last.fm/serve/34/39420767.jpg</image>
22
+ <image size="medium">http://userserve-ak.last.fm/serve/64/39420767.jpg</image>
23
+ <image size="large">http://userserve-ak.last.fm/serve/126/39420767.jpg</image>
24
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/39420767.jpg</image>
25
+ <image size="mega">http://userserve-ak.last.fm/serve/500/39420767/Megadeth+Hangar18single.jpg</image>
26
+ </artist>
27
+ <artist>
28
+ <name>Slayer</name>
29
+ <url>http://www.last.fm/music/Slayer</url>
30
+ <image size="small">http://userserve-ak.last.fm/serve/34/12401617.jpg</image>
31
+ <image size="medium">http://userserve-ak.last.fm/serve/64/12401617.jpg</image>
32
+ <image size="large">http://userserve-ak.last.fm/serve/126/12401617.jpg</image>
33
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/12401617.jpg</image>
34
+ <image size="mega">http://userserve-ak.last.fm/serve/500/12401617/Slayer+attack.jpg</image>
35
+ </artist>
36
+ <artist>
37
+ <name>Iron Maiden</name>
38
+ <url>http://www.last.fm/music/Iron+Maiden</url>
39
+ <image size="small">http://userserve-ak.last.fm/serve/34/23808077.jpg</image>
40
+ <image size="medium">http://userserve-ak.last.fm/serve/64/23808077.jpg</image>
41
+ <image size="large">http://userserve-ak.last.fm/serve/126/23808077.jpg</image>
42
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/23808077.jpg</image>
43
+ <image size="mega">http://userserve-ak.last.fm/serve/500/23808077/Iron+Maiden+hahahahihihyk2.jpg</image>
44
+ </artist>
45
+ <artist>
46
+ <name>Anthrax</name>
47
+ <url>http://www.last.fm/music/Anthrax</url>
48
+ <image size="small">http://userserve-ak.last.fm/serve/34/34381515.jpg</image>
49
+ <image size="medium">http://userserve-ak.last.fm/serve/64/34381515.jpg</image>
50
+ <image size="large">http://userserve-ak.last.fm/serve/126/34381515.jpg</image>
51
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/34381515.jpg</image>
52
+ <image size="mega">http://userserve-ak.last.fm/serve/_/34381515/Anthrax.jpg</image>
53
+ </artist>
54
+ <artist>
55
+ <name>Pantera</name>
56
+ <url>http://www.last.fm/music/Pantera</url>
57
+ <image size="small">http://userserve-ak.last.fm/serve/34/34169679.jpg</image>
58
+ <image size="medium">http://userserve-ak.last.fm/serve/64/34169679.jpg</image>
59
+ <image size="large">http://userserve-ak.last.fm/serve/126/34169679.jpg</image>
60
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/34169679.jpg</image>
61
+ <image size="mega">http://userserve-ak.last.fm/serve/_/34169679/Pantera.jpg</image>
62
+ </artist>
63
+ </similar>
64
+ <tags>
65
+ <tag>
66
+ <name>thrash metal</name>
67
+ <url>http://www.last.fm/tag/thrash%20metal</url>
68
+ </tag>
69
+ <tag>
70
+ <name>metal</name>
71
+ <url>http://www.last.fm/tag/metal</url>
72
+ </tag>
73
+ <tag>
74
+ <name>heavy metal</name>
75
+ <url>http://www.last.fm/tag/heavy%20metal</url>
76
+ </tag>
77
+ <tag>
78
+ <name>hard rock</name>
79
+ <url>http://www.last.fm/tag/hard%20rock</url>
80
+ </tag>
81
+ <tag>
82
+ <name>rock</name>
83
+ <url>http://www.last.fm/tag/rock</url>
84
+ </tag>
85
+ </tags>
86
+ <bio>
87
+ <published>Sat, 21 Aug 2010 09:46:32 +0000</published>
88
+ <summary><![CDATA[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.]]></summary>
89
+ <content><![CDATA[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. Metallica has been through several bassists, including Ron McGovney, Cliff Burton (who died in a bus crash while the band was on tour), and Jason Newsted. The current bassist is Robert Trujillo, who joined in 2003.
90
+
91
+ Metallica’s early releases included fast tempos, instrumentals, and aggressive musicianship that placed them as one of the “big four” of the thrash metal sub-genre alongside Slayer, Megadeth, and Anthrax. The band earned a growing fan base in the underground music community and critical acclaim, with the 1986 release Master of Puppets described as one of the most influential and “heavy” metal albums. The band achieved substantial commercial success with Metallica (1991), which debuted at number one on the Billboard 200. With this release the band expanded its musical direction resulting in an album that appealed to a more mainstream audience.
92
+
93
+ In 2000, Metallica was among several artists who filed a lawsuit against Napster for sharing the band’s copyright-protected material for free without the band members’ consent. A settlement was reached, and Napster became a pay-to-use service. Despite reaching number one on the Billboard 200, the release of St. Anger alienated many fans with the exclusion of guitar solos and the “steel-sounding” snare drum. A film titled Some Kind of Monster documented the recording process of St. Anger.
94
+
95
+ Metallica has released nine studio albums, two live albums, two EPs, twenty-two music videos, and forty-four singles. The band has won nine Grammy Awards, and has had five consecutive albums debut at number one on the Billboard 200, making Metallica the only band ever to do so. The band’s 1991 album, Metallica, has sold over 15 million copies in the United States, and 22 million copies worldwide, which makes it the 25th-highest-selling album in the country. The band has sold an estimated 100 million records worldwide as of the release of their latest album Death Magnetic. As of September 2008, Metallica is the fourth highest-selling music artist since the SoundScan era began tracking sales on May 25, 1991, selling a total of 51,136,000 albums in the United States alone.
96
+
97
+ Metallica was inducted into the Rock and Roll Hall of Fame in 2009. Metallica organised a brand new festival. They called it Sonishpere. Several cities in Europe were chosen by the band.
98
+
99
+ <strong>Current members:</strong>
100
+
101
+ <a href="http://www.last.fm/music/James+Hetfield" class="bbcode_artist">James Hetfield</a> – lead vocals, rhythm guitar (1981–present)
102
+ <a href="http://www.last.fm/music/Lars+Ulrich" class="bbcode_artist">Lars Ulrich</a> – drums, percussion (1981–present)
103
+ <a href="http://www.last.fm/music/Kirk+Hammett" class="bbcode_artist">Kirk Hammett</a> – lead guitar, backing vocals (1983–present)
104
+ <a href="http://www.last.fm/music/Robert+Trujillo" class="bbcode_artist">Robert Trujillo</a> – bass, backing vocals (2003–present).
105
+
106
+ <strong>Former members:</strong>
107
+
108
+ <a href="http://www.last.fm/music/Ron+McGovney" class="bbcode_artist">Ron McGovney</a>– bass (1982)
109
+ <a href="http://www.last.fm/music/Dave+Mustaine" class="bbcode_artist">Dave Mustaine</a> – lead guitar, backing vocals (1982–1983)
110
+ <a href="http://www.last.fm/music/Cliff+Burton" class="bbcode_artist">Cliff Burton</a> – bass, backing vocals (1982–1986)
111
+ <a href="http://www.last.fm/music/Jason+Newsted" class="bbcode_artist">Jason Newsted</a> – bass, backing vocals (1986–2001).
112
+
113
+ User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.]]></content>
114
+ </bio>
115
+ </artist></lfm>
@@ -0,0 +1,55 @@
1
+ <lfm status="ok">
2
+ <track>
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[&quot;Before He Cheats&quot; 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, (&quot;No Air&quot; 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[&quot;Before He Cheats&quot; 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, (&quot;No Air&quot; 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>
@@ -41,7 +41,7 @@ class TestAlbum < Test::Unit::TestCase
41
41
  assert_equal(Time.mktime(2005, 11, 15, 00, 00, 00), album.release_date)
42
42
  end
43
43
 
44
- test "should be able to include the album's info on initialize" do
44
+ test "should be able to request detailed album info on initialize" do
45
45
  album = Rockstar::Album.new('Carrie Underwood', 'Some Hearts', :include_info => true)
46
46
  assert_equal('Carrie Underwood', album.artist)
47
47
  assert_equal('Some Hearts', album.name)
@@ -14,6 +14,18 @@ class TestArtist < Test::Unit::TestCase
14
14
  assert_equal('Metallica', @artist.name)
15
15
  end
16
16
 
17
+ test "should be able to load artist info" do
18
+ @artist.load_info
19
+ assert_equal("http://www.last.fm/music/Metallica", @artist.url)
20
+ assert_equal("65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab", @artist.mbid)
21
+ end
22
+
23
+ test "should load artist info when initialized" do
24
+ artist = Rockstar::Artist.new("Metallica", :include_info => true)
25
+ assert_equal("http://www.last.fm/music/Metallica", artist.url)
26
+ assert_equal("65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab", artist.mbid)
27
+ end
28
+
17
29
  test 'should be able to find similar artists' do
18
30
  assert_equal(["Megadeth", "Slayer", "Iron Maiden", "Pantera", "Anthrax", "Sepultura"], @artist.similar.collect(&:name)[0..5])
19
31
  first = @artist.similar.first
@@ -21,7 +21,27 @@ class TestTrack < Test::Unit::TestCase
21
21
  test 'should know the name' do
22
22
  assert_equal('Before He Cheats', @track.name)
23
23
  end
24
+
25
+ test 'should be able to load track info' do
26
+ @track.load_info
27
+ assert_equal('http://www.last.fm/music/Carrie+Underwood/_/Before+He+Cheats', @track.url)
28
+ assert_equal('1040848', @track.playcount)
29
+ end
30
+
31
+ test 'should be able to request detailed album info on initialize' do
32
+ track = Rockstar::Track.new('Carrie Underwood', 'Before He Cheats', :include_info => true)
33
+ assert_equal('Carrie Underwood', track.artist)
34
+ assert_equal('http://www.last.fm/music/Carrie+Underwood/_/Before+He+Cheats', track.url)
35
+ assert_equal('1040848', track.playcount)
36
+ end
24
37
 
38
+ test 'should have albums' do
39
+ assert_equal(1, @track.albums.size)
40
+ assert_equal('Some Hearts', @track.albums.first.name)
41
+ assert_equal('http://www.last.fm/music/Carrie+Underwood/Some+Hearts', @track.albums.first.url)
42
+ assert_equal('a33b9822-9f09-4e19-9d6e-e05af85c727b', @track.albums.first.mbid)
43
+ end
44
+
25
45
  test 'should have fans' do
26
46
  assert_equal(50, @track.fans.size)
27
47
  assert_equal('chelseaf89', @track.fans.first.username)
@@ -46,7 +66,7 @@ class TestTrack < Test::Unit::TestCase
46
66
  end
47
67
 
48
68
  test 'can scrobble tracks' do
49
- assert_equal('ok', @track.scrobble(Time.new(2010,10,10,10,10), 'tag'))
69
+ assert_equal('ok', @track.scrobble(Time.utc(2010,10,10,8,10), 'tag'))
50
70
  end
51
71
 
52
72
  test 'raise missing parameter error in update now playing' do
@@ -54,7 +74,7 @@ class TestTrack < Test::Unit::TestCase
54
74
  end
55
75
 
56
76
  test 'can send current playing track' do
57
- assert_equal('ok', @track.updateNowPlaying(Time.new(2010,10,10,10,10), 'tag'))
77
+ assert_equal('ok', @track.updateNowPlaying(Time.utc(2010,10,10,8,10), 'tag'))
58
78
  end
59
79
 
60
80
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rockstar
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.1
5
+ version: 0.5.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Bodo Tasche
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-20 00:00:00 +01:00
13
+ date: 2011-04-03 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -82,6 +82,7 @@ files:
82
82
  - rockstar.gemspec
83
83
  - test/fixtures/xml/album/getinfo_album_Radio_Retalation_artist_Thievery_Corporation.xml
84
84
  - test/fixtures/xml/album/getinfo_album_Some_Hearts_artist_Carrie_Underwood.xml
85
+ - test/fixtures/xml/artist/getinfo_artist_Metallica.xml
85
86
  - test/fixtures/xml/artist/getsimilar_artist_Metallica.xml
86
87
  - test/fixtures/xml/artist/gettopalbums_artist_Metallica.xml
87
88
  - test/fixtures/xml/artist/gettopfans_artist_Metallica.xml
@@ -93,6 +94,7 @@ files:
93
94
  - test/fixtures/xml/tag/gettopartists_tag_rock.xml
94
95
  - test/fixtures/xml/tag/gettoptags.xml
95
96
  - test/fixtures/xml/tag/gettoptracks_tag_rock.xml
97
+ - test/fixtures/xml/track/getinfo_artist_Carrie_Underwood_track_Before_He_Cheats.xml
96
98
  - test/fixtures/xml/track/gettopfans_artist_Carrie_Underwood_track_Before_He_Cheats.xml
97
99
  - test/fixtures/xml/track/gettoptags_artist_Carrie_Underwood_track_Before_He_Cheats.xml
98
100
  - test/fixtures/xml/track/love_artist_Carrie_Underwood_sk_tag_track_Before_He_Cheats.xml
@@ -157,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
159
  requirements: []
158
160
 
159
161
  rubyforge_project:
160
- rubygems_version: 1.5.2
162
+ rubygems_version: 1.6.1
161
163
  signing_key:
162
164
  specification_version: 3
163
165
  summary: wrapper for audioscrobbler (last.fm) web services