firstfm 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 3
4
- :patch: 1
3
+ :minor: 4
4
+ :patch: 0
5
5
  :build:
data/firstfm.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "firstfm"
8
- s.version = "0.3.1"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aleksandr Lossenko"]
12
- s.date = "2012-04-25"
12
+ s.date = "2012-07-18"
13
13
  s.description = "Firstfm is a ruby wrapper for the Last.fm APIs ( http://www.last.fm/api ). My main focus is to import events from Last.FM, but with time I will try to add support for all API methods."
14
14
  s.email = "aleksandr.lossenko@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/firstfm/location.rb",
34
34
  "lib/firstfm/track.rb",
35
35
  "lib/firstfm/venue.rb",
36
+ "test/fixtures/artist.xml",
36
37
  "test/fixtures/artists.xml",
37
38
  "test/fixtures/event.xml",
38
39
  "test/fixtures/events.xml",
@@ -53,7 +54,7 @@ Gem::Specification.new do |s|
53
54
  s.homepage = "http://github.com/egze/firstfm"
54
55
  s.licenses = ["MIT"]
55
56
  s.require_paths = ["lib"]
56
- s.rubygems_version = "1.8.15"
57
+ s.rubygems_version = "1.8.24"
57
58
  s.summary = "A ruby wrapper for the Last.fm APIs"
58
59
 
59
60
  if s.respond_to? :specification_version then
@@ -17,6 +17,13 @@ module Firstfm
17
17
  def initialize(params = {})
18
18
  @name = params[:name]
19
19
  end
20
+
21
+ def get_tags
22
+ name_params = !self.mbid.nil? ? {:artist => self.name} : {:mbid => self.mbid}
23
+ response = self.class.get("/2.0/", {:query => {:method => 'artist.getInfo', :api_key => Firstfm::CONFIG['api_key']}.merge(name_params)})
24
+ tags_array = (response["lfm"] and response["lfm"]["artist"] and response["lfm"]["artist"]["tags"] and response["lfm"]["artist"]["tags"]["tag"]) || []
25
+ tags_array.map {|t| t["name"] }
26
+ end
20
27
 
21
28
  def get_images(page = 1, limit = 50)
22
29
  name_params = !self.mbid.nil? ? {:artist => self.name} : {:mbid => self.mbid}
@@ -0,0 +1,112 @@
1
+
2
+ <?xml version="1.0" encoding="utf-8"?>
3
+ <lfm status="ok">
4
+ <artist>
5
+ <name>Cher</name>
6
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
7
+ <url>http://www.last.fm/music/Cher</url>
8
+ <image size="small">http://userserve-ak.last.fm/serve/34/62203963.png</image>
9
+ <image size="medium">http://userserve-ak.last.fm/serve/64/62203963.png</image>
10
+ <image size="large">http://userserve-ak.last.fm/serve/126/62203963.png</image>
11
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/62203963.png</image>
12
+ <image size="mega">http://userserve-ak.last.fm/serve/500/62203963/Cher.png</image>
13
+ <streamable>1</streamable>
14
+ <stats>
15
+ <listeners>779214</listeners>
16
+ <playcount>8071984</playcount>
17
+ </stats>
18
+
19
+ <similar>
20
+ <artist>
21
+ <name>Sonny &amp; Cher</name>
22
+ <url>http://www.last.fm/music/Sonny+&amp;+Cher</url>
23
+ <image size="small">http://userserve-ak.last.fm/serve/34/71168880.png</image>
24
+ <image size="medium">http://userserve-ak.last.fm/serve/64/71168880.png</image>
25
+ <image size="large">http://userserve-ak.last.fm/serve/126/71168880.png</image>
26
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/71168880.png</image>
27
+ <image size="mega">http://userserve-ak.last.fm/serve/500/71168880/Sonny++Cher.png</image>
28
+
29
+ </artist>
30
+ <artist>
31
+ <name>Cyndi Lauper</name>
32
+ <url>http://www.last.fm/music/Cyndi+Lauper</url>
33
+ <image size="small">http://userserve-ak.last.fm/serve/34/76537198.png</image>
34
+ <image size="medium">http://userserve-ak.last.fm/serve/64/76537198.png</image>
35
+ <image size="large">http://userserve-ak.last.fm/serve/126/76537198.png</image>
36
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/76537198.png</image>
37
+ <image size="mega">http://userserve-ak.last.fm/serve/_/76537198/Cyndi+Lauper+++I+have+a+dream.png</image>
38
+
39
+ </artist>
40
+ <artist>
41
+ <name>Madonna</name>
42
+ <url>http://www.last.fm/music/Madonna</url>
43
+ <image size="small">http://userserve-ak.last.fm/serve/34/8451547.jpg</image>
44
+ <image size="medium">http://userserve-ak.last.fm/serve/64/8451547.jpg</image>
45
+ <image size="large">http://userserve-ak.last.fm/serve/126/8451547.jpg</image>
46
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/8451547.jpg</image>
47
+ <image size="mega">http://userserve-ak.last.fm/serve/_/8451547/Madonna+Confessions+on+a+Dance+Floor+p.jpg</image>
48
+
49
+ </artist>
50
+ <artist>
51
+ <name>Kylie Minogue</name>
52
+ <url>http://www.last.fm/music/Kylie+Minogue</url>
53
+ <image size="small">http://userserve-ak.last.fm/serve/34/75585696.png</image>
54
+ <image size="medium">http://userserve-ak.last.fm/serve/64/75585696.png</image>
55
+ <image size="large">http://userserve-ak.last.fm/serve/126/75585696.png</image>
56
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/75585696.png</image>
57
+ <image size="mega">http://userserve-ak.last.fm/serve/_/75585696/Kylie+Minogue+simplemente+Kylie.png</image>
58
+
59
+ </artist>
60
+ <artist>
61
+ <name>Tina Turner</name>
62
+ <url>http://www.last.fm/music/Tina+Turner</url>
63
+ <image size="small">http://userserve-ak.last.fm/serve/34/74998404.jpg</image>
64
+ <image size="medium">http://userserve-ak.last.fm/serve/64/74998404.jpg</image>
65
+ <image size="large">http://userserve-ak.last.fm/serve/126/74998404.jpg</image>
66
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/74998404.jpg</image>
67
+ <image size="mega">http://userserve-ak.last.fm/serve/_/74998404/Tina+Turner+Queen+3.jpg</image>
68
+
69
+ </artist>
70
+ </similar>
71
+ <tags>
72
+ <tag>
73
+ <name>pop</name>
74
+ <url>http://www.last.fm/tag/pop</url>
75
+ </tag>
76
+ <tag>
77
+ <name>female vocalists</name>
78
+ <url>http://www.last.fm/tag/female%20vocalists</url>
79
+ </tag>
80
+ <tag>
81
+ <name>80s</name>
82
+ <url>http://www.last.fm/tag/80s</url>
83
+ </tag>
84
+ <tag>
85
+ <name>dance</name>
86
+ <url>http://www.last.fm/tag/dance</url>
87
+ </tag>
88
+ <tag>
89
+ <name>rock</name>
90
+ <url>http://www.last.fm/tag/rock</url>
91
+ </tag>
92
+ </tags>
93
+ <bio>
94
+ <published>Fri, 13 Jul 2012 09:56:53 +0000</published>
95
+ <summary><![CDATA[Cher (born Cherilyn Sarkisian on May 20, 1946) is an American singer, actress, songwriter, author and entertainer. Among her many career accomplishments in music, television and film, she has won an Academy Award, a Grammy Award, an Emmy Award and three Golden Globe Awards among others. Referred to as the Goddess of Pop, Cher first rose to prominence in 1965 as one half of the pop/rock duo Sonny &amp; Cher.]]></summary>
96
+ <content><![CDATA[Cher (born Cherilyn Sarkisian on May 20, 1946) is an American singer, actress, songwriter, author and entertainer. Among her many career accomplishments in music, television and film, she has won an Academy Award, a Grammy Award, an Emmy Award and three Golden Globe Awards among others.
97
+
98
+ Referred to as the Goddess of Pop, Cher first rose to prominence in 1965 as one half of the pop/rock duo Sonny &amp; Cher. She also established herself as a solo recording artist, releasing 25 albums, contributing to numerous compilations, and tallying 34 Billboard Top 40 entries over her career, both solo and with Sonny. These include eighteen Top 10 singles and five number one singles (four solo). Cher has had 16 top ten hits in the UK between 1965 and 2003, four of which reached number one (two solo, one with Sonny, one as part of a charity single).
99
+
100
+ In a career surpassing 40 years, Cher has been described as an enduring pop icon and one of the most popular female artists in music history. Since her debut in 1964, Cher has sold as a solo artist over 180 million records worldwide and an estimated 70 million singles and with duo Sonny and Cher over 80 million records becoming one of the biggest-selling artists of all time.
101
+
102
+ She became a television star in the 1970s and a film actress in the 1980s. In 1987, she won the Academy Award for Best Actress for her role in the romantic comedy Moonstruck.
103
+
104
+ During 2007, in the seventh volume of Chrome Hearts, Cher once again confirmed that she is working on her twenty-sixth studio album. The genre of the album is due to be hardcore dance and the album will be available in late 2012.
105
+
106
+ On February 7, 2008 Cher, at 61, announced that she had reached a deal to perform 200 shows over three years live at the Colosseum at Caesar's Palace in Las Vegas. Her new show, entitled Cher at the Colosseum, debuted on May 6, 2008. The show reportedly includes 18 dancers, 4 aerialists, and multiple costumes designed by Bob Mackie. Choreography will be directed by Doriana Sanchez who also worked with Cher on her past three major tours. Her show will perform four nights a week for a month, and a second leg of the show will continue in August. Cher will share the stage on a rotating basis with contemporaries Bette Midler (whose The Showgirl Must Go On opened on February 20, 2008) and Elton John (whose The Red Piano which opened in 2004, will continues its run of about 50 shows a year).
107
+
108
+ Cher made her musical debut and first film role in a decade in <em>Burlesque</em>, starring alongside Christina Aguilera, who also made her musical and film debut. The film was released in November 2010.
109
+
110
+ User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.]]></content>
111
+ </bio>
112
+ </artist></lfm>
data/test/test_artist.rb CHANGED
@@ -44,5 +44,14 @@ class TestArtist < Test::Unit::TestCase
44
44
  assert_equal 50, images.size
45
45
  assert images.detect {|i| i.with_width(600) }
46
46
  end
47
+
48
+ def test_should_get_tags
49
+ 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.xml"))
52
+ tags = artist.get_tags
53
+ assert_equal 5, tags.size
54
+ assert (tags - ["pop", "female vocalists", "80s", "dance", "rock"]).empty?
55
+ end
47
56
 
48
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firstfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-25 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &70180735897280 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0.8'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70180735897280
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.8'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: crack
27
- requirement: &70180735896740 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0.3'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70180735896740
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.3'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: will_paginate
38
- requirement: &70180735912480 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '3.0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70180735912480
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: chronic
49
- requirement: &70180735911960 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0.6'
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70180735911960
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '0.6'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rake
60
- requirement: &70180735911400 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70180735911400
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: bundler
71
- requirement: &70180735910860 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70180735910860
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: jeweler
82
- requirement: &70180735910160 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70180735910160
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: fakeweb
93
- requirement: &70180735909480 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,7 +133,12 @@ dependencies:
98
133
  version: '0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *70180735909480
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  description: Firstfm is a ruby wrapper for the Last.fm APIs ( http://www.last.fm/api
103
143
  ). My main focus is to import events from Last.FM, but with time I will try to add
104
144
  support for all API methods.
@@ -125,6 +165,7 @@ files:
125
165
  - lib/firstfm/location.rb
126
166
  - lib/firstfm/track.rb
127
167
  - lib/firstfm/venue.rb
168
+ - test/fixtures/artist.xml
128
169
  - test/fixtures/artists.xml
129
170
  - test/fixtures/event.xml
130
171
  - test/fixtures/events.xml
@@ -156,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
197
  version: '0'
157
198
  segments:
158
199
  - 0
159
- hash: 2571708669482167572
200
+ hash: -3066058059713055905
160
201
  required_rubygems_version: !ruby/object:Gem::Requirement
161
202
  none: false
162
203
  requirements:
@@ -165,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
206
  version: '0'
166
207
  requirements: []
167
208
  rubyforge_project:
168
- rubygems_version: 1.8.15
209
+ rubygems_version: 1.8.24
169
210
  signing_key:
170
211
  specification_version: 3
171
212
  summary: A ruby wrapper for the Last.fm APIs