sandro-metamuse 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/History ADDED
@@ -0,0 +1,12 @@
1
+ 0.1.2 07/18/2009
2
+ * Modified Cracks date parser, queries for Radiohead now work
3
+ * Ruby 1.9 compatibility
4
+ * Moved Metamuse queries from echonest to Lastfm
5
+ * Lastfm seems pretty good at guessing artist names and is faster than echonest
6
+ * LastFm::Artist class introduced which has many attributes
7
+
8
+ 0.1.1 07/18/2009
9
+ * Fix album sorting, pushing nil ranking to the end of the list
10
+
11
+ 0.1.0 07/19/2009
12
+ * Initial Release
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/hash_ext.rb ADDED
@@ -0,0 +1,21 @@
1
+ class Hash
2
+ def rename_key(old_key, key)
3
+ dup.rename_key! old_key, key
4
+ end
5
+
6
+ def rename_key!(old_key, key)
7
+ store(key, delete(old_key))
8
+ self
9
+ end
10
+
11
+ def rename_keys(replacements={})
12
+ dup.rename_keys! replacements
13
+ end
14
+
15
+ def rename_keys!(replacements={})
16
+ replacements.each do |old_key, key|
17
+ rename_key!(old_key, key)
18
+ end
19
+ self
20
+ end
21
+ end
data/lib/metamuse.rb CHANGED
@@ -7,8 +7,10 @@ require 'httparty'
7
7
  require 'httparty_ext'
8
8
  require 'object_ext'
9
9
  require 'array_ext'
10
+ require 'hash_ext'
10
11
  require 'arrayish'
11
12
 
13
+ require 'metamuse/instance_initialize'
12
14
  require 'metamuse/collection'
13
15
  require 'metamuse/association'
14
16
  require 'metamuse/services'
@@ -17,6 +19,9 @@ require 'metamuse/services/freebase'
17
19
  require 'metamuse/services/music_brainz'
18
20
  require 'metamuse/services/lastfm'
19
21
  require 'metamuse/services/lastfm/image'
22
+ require 'metamuse/services/lastfm/artist'
23
+
24
+ Crack::JSON::DATE_REGEX = /^\d{4}-\d{2}-\d{2}$|^\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/
20
25
 
21
26
  module Metamuse
22
27
  autoload :Artist, 'metamuse/artist'
@@ -37,7 +42,7 @@ module Metamuse
37
42
  end
38
43
 
39
44
  def find_artist(name)
40
- Services::Echonest.artist(name)
45
+ Services::Lastfm.artist(name)
41
46
  end
42
47
 
43
48
  private
@@ -56,16 +61,4 @@ module Metamuse
56
61
  end
57
62
  end
58
63
  end
59
-
60
- module InstanceInitialize
61
- def initialize(attrs={})
62
- attrs.each do |k,v|
63
- if self.class.has_many_set.values.include?(k)
64
- send "#{k}=", v
65
- else
66
- instance_variable_set "@#{k}", v
67
- end
68
- end
69
- end
70
- end
71
64
  end
@@ -3,6 +3,7 @@ module Metamuse
3
3
  include InstanceInitialize
4
4
  extend Association
5
5
  has_many :tracks, Track
6
+ belongs_to :artist, Artist
6
7
 
7
8
  attr_accessor :name, :release_date, :freebase_id, :mbid, :rank, :images
8
9
 
@@ -4,7 +4,7 @@ module Metamuse
4
4
  extend Association
5
5
  has_many :albums, Album
6
6
 
7
- attr_accessor :name, :echonest_id, :freebase_guid, :mbid
7
+ attr_reader :name, :echonest_id, :freebase_guid, :mbid, :lastfm_url, :images, :listeners, :playcount, :similar_artists, :tags, :biography, :biography_summary
8
8
 
9
9
  def self.build(name)
10
10
  artist = Services::Freebase.artist(name)
@@ -12,6 +12,12 @@ module Metamuse
12
12
  artist
13
13
  end
14
14
 
15
+ def initialize(attrs={})
16
+ @images = []
17
+ @similar_artists = []
18
+ super
19
+ end
20
+
15
21
  def tracks
16
22
  @tracks ||= albums.map{|a| a.tracks}.flatten
17
23
  end
@@ -35,13 +41,13 @@ module Metamuse
35
41
  end
36
42
 
37
43
  def inspect
38
- "#<#{self.class.inspect}:#{object_id.inspect}, name: #{name.inspect}, echonest_id: #{echonest_id.inspect}, freebase_guid: #{freebase_guid.inspect}, mbid: #{mbid.inspect}, albums: #{album_names.inspect}>"
44
+ "#<#{self.class.inspect}:#{object_id.inspect}, name: #{name.inspect}, albums: #{album_names.inspect}>"
39
45
  end
40
46
 
41
47
  private
42
48
 
43
49
  def album_names
44
- @album_names ||= albums.map {|a| a.name}
50
+ albums.map {|a| a.name}
45
51
  end
46
52
 
47
53
  def lastfm_albums
@@ -5,7 +5,6 @@ module Metamuse
5
5
  attr_accessor :has_many_set, :belongs_to_set
6
6
  end
7
7
  base.belongs_to_set = base.has_many_set = {}
8
- base.send :include, InstanceMethods
9
8
  end
10
9
 
11
10
  def has_many(accessor, klass)
@@ -36,10 +35,8 @@ module Metamuse
36
35
  define_method(:"#{accessor}=") do |parent|
37
36
  instance_variable_set(:"@#{accessor}", parent)
38
37
  end
39
- end
40
38
 
41
- module InstanceMethods
42
- def belongs(owner)
39
+ define_method(:belongs) do |owner|
43
40
  accessor = self.class.belongs_to_set[owner.class]
44
41
  send("#{accessor}=", owner) if accessor
45
42
  end
@@ -17,7 +17,7 @@ module Metamuse
17
17
  Array.insist(items).each do |item|
18
18
  item = collection_class.new(item) unless collection_class === item
19
19
  append item
20
- item.belongs owner
20
+ item.try(:belongs, owner)
21
21
  end
22
22
  self
23
23
  end
@@ -0,0 +1,22 @@
1
+ module Metamuse
2
+ module InstanceInitialize
3
+ def initialize(attrs={})
4
+ attrs.each do |k,v|
5
+ setter = "#{k}="
6
+ if self.class.method_defined? setter
7
+ send setter, v
8
+ else
9
+ instance_variable_set "@#{k}", v
10
+ end
11
+ end
12
+ end
13
+
14
+ def attributes
15
+ attrs = {}
16
+ instance_variables.each do |ivar|
17
+ attrs[ivar.to_s.sub('@', '').to_sym] = instance_variable_get(ivar)
18
+ end
19
+ attrs
20
+ end
21
+ end
22
+ end
@@ -11,6 +11,13 @@ module Metamuse
11
11
  end
12
12
 
13
13
  def self.artist(name)
14
+ attributes = artist_info(name).best_guess.attributes.rename_key(:url, :lastfm_url)
15
+ ::Metamuse::Artist.new attributes
16
+ end
17
+
18
+ def self.artist_info(name)
19
+ response = get('', :query => {:method => 'artist.getinfo', :artist => name})
20
+ Artist.build response
14
21
  end
15
22
 
16
23
  private
@@ -0,0 +1,48 @@
1
+ class Metamuse::Services::Lastfm::Artist
2
+ attr_reader :name, :mbid, :url, :images, :listeners, :playcount, :similar_artists, :tags, :biography, :biography_summary
3
+
4
+ include ::Metamuse::InstanceInitialize
5
+
6
+ def self.build(response)
7
+ data = response['lfm']['artist']
8
+ new data
9
+ end
10
+
11
+ def initialize(attrs={})
12
+ @similar_artists = []
13
+ @images = []
14
+ super
15
+ end
16
+
17
+ def bio=(bio)
18
+ @biography = bio['content']
19
+ @biography_summary = bio['summary']
20
+ end
21
+
22
+ def images=(urls)
23
+ urls.each do |url|
24
+ @images << Metamuse::Services::Lastfm::Image.new(url) if url.is_a? String
25
+ end
26
+ end
27
+ alias image= images=
28
+
29
+ def best_guess
30
+ valid? ? self : similar_artists.first
31
+ end
32
+
33
+ def similar_artists=(attrs={})
34
+ attrs['artist'].each do |artist_attrs|
35
+ @similar_artists << self.class.new(artist_attrs)
36
+ end
37
+ end
38
+ alias similar= similar_artists=
39
+
40
+ def stats=(stats)
41
+ @playcount = stats['playcount']
42
+ @listeners = stats['listeners']
43
+ end
44
+
45
+ def valid?
46
+ url !~ %r(/music/\+noredirect/)
47
+ end
48
+ end
@@ -2,10 +2,11 @@ class Metamuse::Services::Lastfm::Image
2
2
  attr_reader :location, :size
3
3
 
4
4
  DIMENSIONS = {
5
- :small => '34x34',
6
- :medium => '64x64',
7
- :large => '126x126',
8
- :extra_large => '300x300'
5
+ "34x34" => :small,
6
+ "64x64" => :medium,
7
+ "126x126" => :large,
8
+ "252x247" => :extra_large,
9
+ "300x300" => :extra_large
9
10
  }
10
11
 
11
12
  def initialize(location)
@@ -14,7 +15,7 @@ class Metamuse::Services::Lastfm::Image
14
15
  end
15
16
 
16
17
  def dimensions
17
- DIMENSIONS[size]
18
+ DIMENSIONS.index size
18
19
  end
19
20
 
20
21
  def height
@@ -28,14 +29,13 @@ class Metamuse::Services::Lastfm::Image
28
29
  private
29
30
 
30
31
  def set_size
31
- @size = DIMENSIONS.index(dimension_value_from_location)
32
+ dimension = DIMENSIONS.keys.detect {|d| d =~ %r(^#{width_from_location}x)}
33
+ @size = DIMENSIONS[dimension]
32
34
  end
33
35
 
34
- def dimension_value_from_location
36
+ def width_from_location
35
37
  size_regexp = %r(/serve/(\d+).*/)
36
38
  match = location.match size_regexp
37
- if match && width = match.captures.first
38
- "#{width}x#{width}"
39
- end
39
+ match && match.captures.first
40
40
  end
41
41
  end
@@ -9,5 +9,9 @@ module Metamuse
9
9
  def <=>(other)
10
10
  name <=> other.name
11
11
  end
12
+
13
+ def inspect
14
+ "#<#{self.class.inspect}:#{object_id.inspect}, index: #{index.inspect}, name: #{name.inspect}, album: #{album.name.inspect}>"
15
+ end
12
16
  end
13
17
  end
data/lib/object_ext.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  class Object
2
- def try(method)
3
- send(method) if respond_to? method
2
+ def tap
3
+ yield self
4
+ self
5
+ end
6
+
7
+ def try(method, *args)
8
+ send(method, *args) if respond_to? method
4
9
  end
5
10
 
6
11
  def attempt
data/metamuse.gemspec CHANGED
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{metamuse}
5
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Sandro Turriate"]
9
- s.date = %q{2009-07-24}
12
+ s.date = %q{2009-08-15}
10
13
  s.email = %q{sandro.turriate@gmail.com}
11
14
  s.extra_rdoc_files = [
12
15
  "README.rdoc"
@@ -14,22 +17,26 @@ Gem::Specification.new do |s|
14
17
  s.files = [
15
18
  ".document",
16
19
  ".gitignore",
20
+ "History",
17
21
  "MIT_LICENSE",
18
22
  "README.rdoc",
19
23
  "Rakefile",
20
24
  "VERSION",
21
25
  "lib/array_ext.rb",
22
26
  "lib/arrayish.rb",
27
+ "lib/hash_ext.rb",
23
28
  "lib/httparty_ext.rb",
24
29
  "lib/metamuse.rb",
25
30
  "lib/metamuse/album.rb",
26
31
  "lib/metamuse/artist.rb",
27
32
  "lib/metamuse/association.rb",
28
33
  "lib/metamuse/collection.rb",
34
+ "lib/metamuse/instance_initialize.rb",
29
35
  "lib/metamuse/services.rb",
30
36
  "lib/metamuse/services/echonest.rb",
31
37
  "lib/metamuse/services/freebase.rb",
32
38
  "lib/metamuse/services/lastfm.rb",
39
+ "lib/metamuse/services/lastfm/artist.rb",
33
40
  "lib/metamuse/services/lastfm/image.rb",
34
41
  "lib/metamuse/services/music_brainz.rb",
35
42
  "lib/metamuse/track.rb",
@@ -38,20 +45,21 @@ Gem::Specification.new do |s|
38
45
  "script/console",
39
46
  "spec/fake_object.rb",
40
47
  "spec/fake_object_spec.rb",
48
+ "spec/hash_ext_spec.rb",
41
49
  "spec/metamuse/album_spec.rb",
42
50
  "spec/metamuse/artist_spec.rb",
43
51
  "spec/metamuse/association_spec.rb",
44
52
  "spec/metamuse/collection_spec.rb",
45
53
  "spec/metamuse/services/echonest_spec.rb",
46
54
  "spec/metamuse/services/freebase_spec.rb",
55
+ "spec/metamuse/services/lastfm/artist_spec.rb",
47
56
  "spec/metamuse/services/lastfm/image_spec.rb",
48
57
  "spec/metamuse/services/lastfm_spec.rb",
49
58
  "spec/metamuse/services/music_brainz_spec.rb",
50
59
  "spec/metamuse_spec.rb",
51
60
  "spec/spec_helper.rb",
52
- "spec/web_fixtures/GET_developer.echonest.com-api-search_artists_17a9da1.fixture",
53
- "spec/web_fixtures/GET_developer.echonest.com-api-search_artists_350c352.fixture",
54
61
  "spec/web_fixtures/GET_musicbrainz.org-ws-1-release-bb32aa1d-f37b-4134-8c0e-b43b7a6dab85_b976ba7.fixture",
62
+ "spec/web_fixtures/GET_ws.audioscrobbler.com-2.0_857b5b7.fixture",
55
63
  "spec/web_fixtures/GET_www.freebase.com-api-service-mqlread_60ee2bd.fixture",
56
64
  "spec/web_fixtures/GET_www.freebase.com-api-service-mqlread_b8b2565.fixture"
57
65
  ]
@@ -64,12 +72,14 @@ Gem::Specification.new do |s|
64
72
  s.test_files = [
65
73
  "spec/fake_object.rb",
66
74
  "spec/fake_object_spec.rb",
75
+ "spec/hash_ext_spec.rb",
67
76
  "spec/metamuse/album_spec.rb",
68
77
  "spec/metamuse/artist_spec.rb",
69
78
  "spec/metamuse/association_spec.rb",
70
79
  "spec/metamuse/collection_spec.rb",
71
80
  "spec/metamuse/services/echonest_spec.rb",
72
81
  "spec/metamuse/services/freebase_spec.rb",
82
+ "spec/metamuse/services/lastfm/artist_spec.rb",
73
83
  "spec/metamuse/services/lastfm/image_spec.rb",
74
84
  "spec/metamuse/services/lastfm_spec.rb",
75
85
  "spec/metamuse/services/music_brainz_spec.rb",
data/script/console CHANGED
@@ -1,8 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
2
+ $:.unshift File.dirname(__FILE__)+"/../lib"
4
3
 
5
- libs = " -r irb/completion"
6
- libs << " -r lib/metamuse.rb"
4
+ require 'metamuse'
5
+ require 'irb'
7
6
 
8
- exec "#{irb} #{libs} --simple-prompt"
7
+ IRB.setup(nil)
8
+ irb = IRB::Irb.new
9
+
10
+ IRB.conf[:MAIN_CONTEXT] = irb.context
11
+
12
+ irb.context.evaluate("require 'irb/completion'", 0)
13
+ irb.context.evaluate("Metamuse.send(:register_api_keys)", 0)
14
+ irb.context.evaluate(%(
15
+ def reload!()
16
+ $".grep(/^metamuse/).each {|e| load(e) }
17
+ end
18
+ ), 0)
19
+
20
+ trap("SIGINT") do
21
+ irb.signal_handle
22
+ end
23
+ catch(:IRB_EXIT) do
24
+ irb.eval_input
25
+ end
data/spec/fake_object.rb CHANGED
@@ -4,18 +4,28 @@ module FakeObject
4
4
  end
5
5
 
6
6
  class Fake
7
- attr_reader :name, :strategy, :expectations
8
-
9
7
  def initialize(*args)
10
8
  @strategy = extract_strategy(args.last) || :stub
11
9
  setup args
12
10
  end
13
11
 
12
+ def __expectations__
13
+ @expectations
14
+ end
15
+
16
+ def __name__
17
+ @name
18
+ end
19
+
20
+ def __strategy__
21
+ @strategy
22
+ end
23
+
14
24
  def setup(args)
15
25
  case arg = args.shift
16
26
  when Hash
17
27
  set_expectations arg
18
- when String
28
+ when String, Symbol
19
29
  @name = arg
20
30
  setup args
21
31
  when NilClass
@@ -26,12 +36,12 @@ module FakeObject
26
36
 
27
37
  def set_expectations(expectations)
28
38
  expectations.each do |method_name, return_value|
29
- ::RR.send(strategy, self).__send__(method_name).returns(return_value) # stub(object).method.returns(value)
39
+ ::RR.send(__strategy__, self).__send__(method_name).returns(return_value) # stub(object).method.returns(value)
30
40
  end
31
41
  end
32
42
 
33
43
  def extract_strategy(arg)
34
- arg[:strategy] if Hash === arg
44
+ arg.delete(:strategy) if Hash === arg
35
45
  end
36
46
  end
37
47
  end
@@ -25,9 +25,14 @@ describe FakeObject do
25
25
  FakeObject::Fake.new.should be_instance_of(Fake)
26
26
  end
27
27
 
28
- it "has a name" do
28
+ it "has a string for a name" do
29
29
  f = FakeObject::Fake.new 'fake'
30
- f.name.should == 'fake'
30
+ f.__name__.should == 'fake'
31
+ end
32
+
33
+ it "has a symbol for a name" do
34
+ f = FakeObject::Fake.new :fake
35
+ f.__name__.should == :fake
31
36
  end
32
37
  end
33
38
 
@@ -37,15 +42,20 @@ describe FakeObject do
37
42
  f.greeting.should == 'hi'
38
43
  end
39
44
 
40
- it "responds has a name" do
45
+ it "responds to its name" do
41
46
  f = FakeObject::Fake.new 'Greeter', :greeting => 'hi'
42
- f.name.should == 'Greeter'
47
+ f.__name__.should == 'Greeter'
48
+ end
49
+
50
+ it "doesn't conflict with a stub for 'strategy'" do
51
+ f = FakeObject::Fake.new({:strategy => :run}, :strategy => :mock)
52
+ f.strategy.should == :run
43
53
  end
44
54
 
45
55
  it "uses the mock build strategy" do
46
56
  f = FakeObject::Fake.new({:greeting => 'hi'}, :strategy => :mock)
47
57
  f.greeting
48
- f.strategy.should == :mock
58
+ f.__strategy__.should == :mock
49
59
  end
50
60
  end
51
61
 
@@ -0,0 +1,59 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Hash do
4
+ describe "#rename_key" do
5
+ subject { {:name => 'mel'} }
6
+
7
+ it "renames name to firstname" do
8
+ subject.rename_key(:name, :firstname)[:firstname].should == 'mel'
9
+ end
10
+
11
+ it "removes the name key from the hash" do
12
+ subject.rename_key(:name, :firstname).should_not have_key(:name)
13
+ end
14
+
15
+ it "does not mutate the original hash" do
16
+ subject.rename_key(:name, :firstname)
17
+ subject[:name].should == 'mel'
18
+ subject.should_not have_key(:firstname)
19
+ end
20
+ end
21
+
22
+ describe "#rename_key!" do
23
+ subject { {:name => 'mel'} }
24
+
25
+ it "mutates the original hash" do
26
+ subject.rename_key!(:name, :firstname)
27
+ subject[:firstname].should == 'mel'
28
+ subject.should_not have_key(:name)
29
+ end
30
+ end
31
+
32
+ describe "#rename_keys" do
33
+ subject { {:name => 'mel', :number => 123} }
34
+
35
+ it "renames multiple keys" do
36
+ h = subject.rename_keys(:name => :account_name, :number => :account_number)
37
+ h[:account_name].should == 'mel'
38
+ h[:account_number].should == 123
39
+ end
40
+
41
+ it "removes the original keys" do
42
+ h = subject.rename_keys(:name => :account_name, :number => :account_number)
43
+ h.should_not have_key(:name)
44
+ h.should_not have_key(:number)
45
+ end
46
+ end
47
+
48
+ describe "#rename_keys!" do
49
+ subject { {:name => 'mel', :number => 123} }
50
+
51
+ it "mutates the hash with the renamed keys" do
52
+ subject.rename_keys!(:name => :account_name, :number => :account_number)
53
+ subject[:account_name].should == 'mel'
54
+ subject[:account_number].should == 123
55
+ subject.should_not have_key(:name)
56
+ subject.should_not have_key(:number)
57
+ end
58
+ end
59
+ end
@@ -8,9 +8,18 @@ class TestShoe
8
8
  end
9
9
  end
10
10
 
11
+ class TestSock
12
+ extend Metamuse::Association
13
+ attr_accessor :color
14
+ def initialize(attrs={})
15
+ attrs.each {|k,v| send(:"#{k}=", v)}
16
+ end
17
+ end
18
+
11
19
  class TestPerson
12
20
  extend Metamuse::Association
13
21
  has_many :shoes, TestShoe
22
+ has_many :socks, TestSock
14
23
  end
15
24
  TestShoe.class_eval { belongs_to :person, TestPerson }
16
25
 
@@ -71,4 +80,13 @@ describe Metamuse::Association do
71
80
  @person.shoes.last.person.should == @person
72
81
  end
73
82
  end
83
+
84
+ describe "TestPerson has many socks, TestSock does not belong to TestPerson" do
85
+ it "does not explode" do
86
+ person = TestPerson.new
87
+ expect {
88
+ person.socks << {:color => 'red'}
89
+ }.to_not raise_error
90
+ end
91
+ end
74
92
  end
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+
3
+ describe Metamuse::Services::Lastfm::Artist do
4
+ subject { Metamuse::Services::Lastfm::Artist }
5
+
6
+ describe "#best_guess" do
7
+ it "returns itself when the artist is valid" do
8
+ artist = subject.new :url => 'http://last.fm/music/Coldplay'
9
+ artist.best_guess.should == artist
10
+ end
11
+
12
+ it "returns the most similar artist when the artist is invalid" do
13
+ similar_artist = fake(:similar_artist)
14
+ artist = subject.new :url => 'http://last.fm/music/+noredirect/Cold Play'
15
+ mock(artist).similar_artists { [similar_artist] }
16
+ artist.best_guess.should == similar_artist
17
+ end
18
+ end
19
+
20
+ describe "#valid?" do
21
+ it "is an invalid artist when the url contains '+noredirect'" do
22
+ artist = subject.new :url => 'http://last.fm/music/+noredirect/Cold Play'
23
+ artist.should_not be_valid
24
+ end
25
+
26
+ it "is a valid artist without redirection" do
27
+ artist = subject.new :url => 'http://last.fm/music/Coldplay'
28
+ artist.should be_valid
29
+ end
30
+ end
31
+ end
@@ -15,7 +15,7 @@ describe Metamuse::Services::Lastfm::Image do
15
15
  end
16
16
 
17
17
  it "has small dimensions" do
18
- subject.dimensions.should == Metamuse::Services::Lastfm::Image::DIMENSIONS[:small]
18
+ subject.dimensions.should == Metamuse::Services::Lastfm::Image::DIMENSIONS.index(:small)
19
19
  end
20
20
 
21
21
  describe "#size" do
@@ -3,14 +3,14 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "Metamuse" do
4
4
  describe "integration" do
5
5
  it "finds coldplay" do
6
- Metamuse.echonest_api_key = "TEST"
6
+ Metamuse.lastfm_api_key = "TEST"
7
7
  Metamuse.find_artist('coldplay').name.should == 'Coldplay'
8
8
  end
9
9
  end
10
10
 
11
11
  describe "finding an artist" do
12
- it "searches through echonest" do
13
- mock(Metamuse::Services::Echonest).artist('coldplay')
12
+ it "searches through lastfm" do
13
+ mock(Metamuse::Services::Lastfm).artist('coldplay')
14
14
  Metamuse.find_artist('coldplay')
15
15
  end
16
16
  end
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:FakeWeb::Fixture
2
+ file_name: GET_ws.audioscrobbler.com-2.0_857b5b7.fixture
3
+ method: :get
4
+ path: /Users/santuri/Code/Ruby/metamuse/spec/web_fixtures
5
+ response: !ruby/object:Net::HTTPOK
6
+ body: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\
7
+ <lfm status=\"ok\">\n\
8
+ <artist>\n <name>Coldplay</name>\n <mbid>cc197bad-dc9c-440d-a5b5-d52ba2e14234</mbid>\n <url>http://www.last.fm/music/Coldplay</url>\n <image size=\"small\">http://userserve-ak.last.fm/serve/34/17666215.jpg</image>\n <image size=\"medium\">http://userserve-ak.last.fm/serve/64/17666215.jpg</image>\n <image size=\"large\">http://userserve-ak.last.fm/serve/126/17666215.jpg</image>\n <image size=\"extralarge\">http://userserve-ak.last.fm/serve/252/17666215.jpg</image>\n <image size=\"mega\"></image>\n <streamable>1</streamable>\n <stats>\n <listeners>2389598</listeners>\n <playcount>122085819</playcount>\n </stats>\n\n <similar>\n\
9
+ \t <artist>\n\
10
+ \t <name>Keane</name>\n\
11
+ \t <url>http://www.last.fm/music/Keane</url>\n\
12
+ \t <image size=\"small\">http://userserve-ak.last.fm/serve/34/13023229.jpg</image>\n\
13
+ \t <image size=\"medium\">http://userserve-ak.last.fm/serve/64/13023229.jpg></image>\n\
14
+ \t <image size=\"large\">http://userserve-ak.last.fm/serve/126/13023229.jpg</image>\n\
15
+ \t <image size=\"extralarge\">http://userserve-ak.last.fm/serve/252/13023229.jpg</image>\n\
16
+ \t <image size=\"mega\">http://userserve-ak.last.fm/serve/500/13023229/Keane+++Sorensmaller.jpg</image>\n\
17
+ \t</artist>\n <artist>\n\
18
+ \t <name>Snow Patrol</name>\n\
19
+ \t <url>http://www.last.fm/music/Snow+Patrol</url>\n\
20
+ \t <image size=\"small\">http://userserve-ak.last.fm/serve/34/13341777.jpg</image>\n\
21
+ \t <image size=\"medium\">http://userserve-ak.last.fm/serve/64/13341777.jpg></image>\n\
22
+ \t <image size=\"large\">http://userserve-ak.last.fm/serve/126/13341777.jpg</image>\n\
23
+ \t <image size=\"extralarge\">http://userserve-ak.last.fm/serve/252/13341777.jpg</image>\n\
24
+ \t <image size=\"mega\">http://userserve-ak.last.fm/serve/500/13341777/Snow+Patrol+sp_press_shot1.jpg</image>\n\
25
+ \t</artist>\n <artist>\n\
26
+ \t <name>Travis</name>\n\
27
+ \t <url>http://www.last.fm/music/Travis</url>\n\
28
+ \t <image size=\"small\">http://userserve-ak.last.fm/serve/34/2243996.jpg</image>\n\
29
+ \t <image size=\"medium\">http://userserve-ak.last.fm/serve/64/2243996.jpg></image>\n\
30
+ \t <image size=\"large\">http://userserve-ak.last.fm/serve/126/2243996.jpg</image>\n\
31
+ \t <image size=\"extralarge\">http://userserve-ak.last.fm/serve/252/2243996.jpg</image>\n\
32
+ \t <image size=\"mega\"></image>\n\
33
+ \t</artist>\n <artist>\n\
34
+ \t <name>The Killers</name>\n\
35
+ \t <url>http://www.last.fm/music/The+Killers</url>\n\
36
+ \t <image size=\"small\">http://userserve-ak.last.fm/serve/34/3216519.jpg</image>\n\
37
+ \t <image size=\"medium\">http://userserve-ak.last.fm/serve/64/3216519.jpg></image>\n\
38
+ \t <image size=\"large\">http://userserve-ak.last.fm/serve/126/3216519.jpg</image>\n\
39
+ \t <image size=\"extralarge\">http://userserve-ak.last.fm/serve/252/3216519.jpg</image>\n\
40
+ \t <image size=\"mega\">http://userserve-ak.last.fm/serve/500/3216519/The+Killers++car.jpg</image>\n\
41
+ \t</artist>\n <artist>\n\
42
+ \t <name>The Fray</name>\n\
43
+ \t <url>http://www.last.fm/music/The+Fray</url>\n\
44
+ \t <image size=\"small\">http://userserve-ak.last.fm/serve/34/22811569.jpg</image>\n\
45
+ \t <image size=\"medium\">http://userserve-ak.last.fm/serve/64/22811569.jpg></image>\n\
46
+ \t <image size=\"large\">http://userserve-ak.last.fm/serve/126/22811569.jpg</image>\n\
47
+ \t <image size=\"extralarge\">http://userserve-ak.last.fm/serve/252/22811569.jpg</image>\n\
48
+ \t <image size=\"mega\"></image>\n\
49
+ \t</artist>\n </similar>\n <tags>\n <tag>\n\
50
+ \t <name>rock</name>\n\
51
+ \t <url>http://www.last.fm/tag/rock</url>\n\
52
+ \t</tag>\n <tag>\n\
53
+ \t <name>alternative</name>\n\
54
+ \t <url>http://www.last.fm/tag/alternative</url>\n\
55
+ \t</tag>\n <tag>\n\
56
+ \t <name>britpop</name>\n\
57
+ \t <url>http://www.last.fm/tag/britpop</url>\n\
58
+ \t</tag>\n <tag>\n\
59
+ \t <name>alternative rock</name>\n\
60
+ \t <url>http://www.last.fm/tag/alternative%20rock</url>\n\
61
+ \t</tag>\n <tag>\n\
62
+ \t <name>indie</name>\n\
63
+ \t <url>http://www.last.fm/tag/indie</url>\n\
64
+ \t</tag>\n </tags>\n <bio>\n <published>Sun, 1 Feb 2009 16:28:40 +0000</published>\n <summary><![CDATA[Coldplay is a British <a href=\"http://www.last.fm/tag/alternative%20rock\" class=\"bbcode_tag\" rel=\"tag\">alternative rock</a> band, formed in London, <a href=\"http://www.last.fm/place/United+Kingdom\" class=\"bbcode_place\">United Kingdom</a> in 1997. The band comprises vocalist and pianist <a href=\"http://www.last.fm/music/Chris+Martin\" class=\"bbcode_artist\">Chris Martin</a>, lead guitarist <a href=\"http://www.last.fm/music/Jonny+Buckland\" class=\"bbcode_artist\">Jonny Buckland</a>, bassist <a href=\"http://www.last.fm/music/Guy+Berryman\" class=\"bbcode_artist\">Guy Berryman</a>, and drummer <a href=\"http://www.last.fm/music/Will+Champion\" class=\"bbcode_artist\">Will Champion</a>. Having released four successful albums, (all of which debuted at #1 on the UK album chart) Coldplay have also achieved great success with their singles, such as <a title=\"Coldplay &ndash; Yellow\" href=\"http://www.last.fm/music/Coldplay/_/Yellow\" class=\"bbcode_track\">Yellow</a>, <a title=\"Coldplay &ndash; Speed of Sound\" href=\"http://www.last.fm/music/Coldplay/_/Speed+of+Sound\" class=\"bbcode_track\">Speed of Sound</a>, the Grammy-winning <a title=\"Coldplay &ndash; Clocks\" href=\"http://www.last.fm/music/Coldplay/_/Clocks\" class=\"bbcode_track\">Clocks</a> and the US and UK #1 single <a title=\"Coldplay &ndash; Viva la Vida\" href=\"http://www.last.fm/music/Coldplay/_/Viva+la+Vida\" class=\"bbcode_track\">Viva la Vida</a>. Frontman Chris Martin credits 1980s Norwegian pop band <a href=\"http://www.last.fm/music/a-ha\" class=\"bbcode_artist\">a-ha</a> for inspiring him to form his own band. ]]></summary>\n <content><![CDATA[<strong>Coldplay</strong> is a British <a href=\"http://www.last.fm/tag/alternative%20rock\" class=\"bbcode_tag\" rel=\"tag\">alternative rock</a> band, formed in London, <a href=\"http://www.last.fm/place/United+Kingdom\" class=\"bbcode_place\">United Kingdom</a> in 1997. The band comprises vocalist and pianist <a href=\"http://www.last.fm/music/Chris+Martin\" class=\"bbcode_artist\">Chris Martin</a>, lead guitarist <a href=\"http://www.last.fm/music/Jonny+Buckland\" class=\"bbcode_artist\">Jonny Buckland</a>, bassist <a href=\"http://www.last.fm/music/Guy+Berryman\" class=\"bbcode_artist\">Guy Berryman</a>, and drummer <a href=\"http://www.last.fm/music/Will+Champion\" class=\"bbcode_artist\">Will Champion</a>.\r \r Having released four successful albums, (all of which debuted at #1 on the UK album chart) Coldplay have also achieved great success with their singles, such as <a title=\"Coldplay &ndash; Yellow\" href=\"http://www.last.fm/music/Coldplay/_/Yellow\" class=\"bbcode_track\">Yellow</a>, <a title=\"Coldplay &ndash; Speed of Sound\" href=\"http://www.last.fm/music/Coldplay/_/Speed+of+Sound\" class=\"bbcode_track\">Speed of Sound</a>, the Grammy-winning <a title=\"Coldplay &ndash; Clocks\" href=\"http://www.last.fm/music/Coldplay/_/Clocks\" class=\"bbcode_track\">Clocks</a> and the US and UK #1 single <a title=\"Coldplay &ndash; Viva la Vida\" href=\"http://www.last.fm/music/Coldplay/_/Viva+la+Vida\" class=\"bbcode_track\">Viva la Vida</a>.\r \r Frontman Chris Martin credits 1980s Norwegian pop band <a href=\"http://www.last.fm/music/a-ha\" class=\"bbcode_artist\">a-ha</a> for inspiring him to form his own band.\r \r Coldplay's early material was often compared to that of <a href=\"http://www.last.fm/music/Jeff+Buckley\" class=\"bbcode_artist\">Jeff Buckley</a> and <a href=\"http://www.last.fm/music/Radiohead\" class=\"bbcode_artist\">Radiohead</a>, while also drawing comparisons to <a href=\"http://www.last.fm/music/U2\" class=\"bbcode_artist\">U2</a> and <a href=\"http://www.last.fm/music/Travis\" class=\"bbcode_artist\">Travis</a>. Since the release of the band's debut album, <em><a title=\"Coldplay - Parachutes\" href=\"http://www.last.fm/music/Coldplay/Parachutes\" class=\"bbcode_album\">Parachutes</a></em> (2000), Coldplay has also drawn influence from other sources, including <a href=\"http://www.last.fm/music/+noredirect/Echo+and+the+Bunnymen\" class=\"bbcode_artist\">Echo and the Bunnymen</a> and <a href=\"http://www.last.fm/music/George+Harrison\" class=\"bbcode_artist\">George Harrison</a> on <em><a title=\"Coldplay - A Rush of Blood to the Head\" href=\"http://www.last.fm/music/Coldplay/A+Rush+of+Blood+to+the+Head\" class=\"bbcode_album\">A Rush of Blood to the Head</a></em> (2002) and <a href=\"http://www.last.fm/music/Johnny+Cash\" class=\"bbcode_artist\">Johnny Cash</a> and <a href=\"http://www.last.fm/music/Kraftwerk\" class=\"bbcode_artist\">Kraftwerk</a> for <em><a title=\"Coldplay - X&amp;Y\" href=\"http://www.last.fm/music/Coldplay/X%2526Y\" class=\"bbcode_album\">X&amp;Y</a></em> (2005).\r \r Coldplay are one of very few current British music acts to achieve major success in North America. Despite their large worldwide popularity, the band has remained protective of how their music is used in the media, refusing its use for product endorsements. In the past, Coldplay had turned down multi-million dollar contracts from Gatorade, Diet Coke, and Gap, who wanted to use the songs &quot;Yellow&quot;, <a title=\"Coldplay &ndash; Trouble\" href=\"http://www.last.fm/music/Coldplay/_/Trouble\" class=\"bbcode_track\">Trouble</a>, and <a title=\"Coldplay &ndash; Don't Panic\" href=\"http://www.last.fm/music/Coldplay/_/Don%27t+Panic\" class=\"bbcode_track\">Don't Panic</a> respectively. According to Martin, &quot;We wouldn't be able to live with ourselves if we sold the songs' meanings like that.&quot; On the other hand, &quot;Yellow&quot; has been used to back TV trailers for &quot;The Simpsons&quot; and &quot;Viva la Vida&quot; from their latest album features on the current iTunes TV advert.\r \r Since 2002, Coldplay have been active supporters of various social and political causes. They have been visible advocates of Oxfam's <em>Make Trade Fair</em> campaign and Amnesty International. The group has also performed at various charity projects such as Band Aid 20, Live 8, and the Teenage Cancer Trust.\r \r The band has released four albums: <em>Parachutes</em> (2000), <em>A Rush Of Blood To The Head</em> (2002), <em>X&amp;Y</em> (2005), and more recently, <em><a title=\"Coldplay - Viva la Vida or Death and All His Friends\" href=\"http://www.last.fm/music/Coldplay/Viva+la+Vida+or+Death+and+All+His+Friends\" class=\"bbcode_album\">Viva la Vida or Death and All His Friends</a></em> (2008).\r \r At the Brit Awards 2006, Chris Martin stated that fans would not see them for a long time, suggesting it would be some time before another studio album was released, if at all. However, the previous day on Valentine's Day 2006, during UK Radio DJ Chris Moyles' Breakfast show, Martin had said, &quot;The next album is very good, and I know because it is already written&quot;, and rumours were that the band would hire their own 'HQ' studio in the style of Kraftwerk's Kling Klang base to record it, so it would seem there was more to come from Coldplay yet.\r \r Coldplay never intended to become England's favorite rock &amp; roll sons when their signature rock melodies ruled the charts throughout 2000. The quartet yearned to mess around a bit, plucking their own acoustics for fun while attending the University College of London. All had been playing instruments since their early teens and had been influenced by the likes of <a href=\"http://www.last.fm/music/Bob+Dylan\" class=\"bbcode_artist\">Bob Dylan</a>, <a href=\"http://www.last.fm/music/The+Stone+Roses\" class=\"bbcode_artist\">The Stone Roses</a>, <a href=\"http://www.last.fm/music/Neil+Young\" class=\"bbcode_artist\">Neil Young</a>, and <a href=\"http://www.last.fm/music/My+Bloody+Valentine\" class=\"bbcode_artist\">My Bloody Valentine</a>.\r \r They never imagined taking reign of the UK's ever-changing rock scene. Each member had come from a solid household of middle-class parents who encouraged music. Martin, the eldest of five siblings, began playing the piano as a young child. He started playing in bands around age 15 and sought solace in the words of <a href=\"http://www.last.fm/music/Tom+Waits\" class=\"bbcode_artist\">Tom Waits</a>. Buckland, on the other hand, was into the heavy guitar work of <a href=\"http://www.last.fm/music/Eric+Clapton\" class=\"bbcode_artist\">Eric Clapton</a> and <a href=\"http://www.last.fm/music/Jimi+Hendrix\" class=\"bbcode_artist\">Jimi Hendrix</a> and was playing guitar by age 11. Scotland native Berryman was into <a href=\"http://www.last.fm/tag/funk\" class=\"bbcode_tag\" rel=\"tag\">funk</a> instead of indie rock, therefore leaving him to play bass. The multi-instrumentalist Champion had not planned to be a drummer until he joined Coldplay. He favoured playing guitar, bass, and the tin whistle, but caught on to playing percussion when the band became official.\r \r When they burst onto the scene, Coldplay were heart-wrenching like Travis, passionate like Jeff Buckley, and as fresh as <a href=\"http://www.last.fm/music/Oasis\" class=\"bbcode_artist\">Oasis</a>. They played their first gig at a festival for unsigned bands in Manchester, and the <em>Safety</em> EP was issued shortly thereafter. The <em>Brothers &amp; Sisters</em> EP was issued by <a href=\"http://www.last.fm/label/Fierce+Panda/\" class=\"bbcode_label\">Fierce Panda</a> and released a year later. (Both releases saw only 500 pressings.) Their sweet melodies and swooning lyrics landed Coldplay a UK deal with <a href=\"http://www.last.fm/label/Parlophone/\" class=\"bbcode_label\">Parlophone</a> in April 1999, and the five-track limited edition <em>Blue Room</em> EP followed that autumn. With nods from the media, the dream pop foursome was hailed as the next Travis, thanks to their simplistic acoustics and charming personas. Two more EPs, <em>Shiver</em> and <em>Yellow</em>, arrived in Spring 2000.\r \r Their full-length debut, <em>Parachutes</em>, earned the band a Mercury Music Prize nomination in the UK. It saw a US release in November 2000, and a month later &quot;Yellow&quot; was chosen as the theme song for all promo spots for the American TV network ABC. The well-received hype surrounding Coldplay continued throughout 2001 as well; they were nominated for three Brit Awards and embarked on a sold-out ten-date tour of the US. Rumours of a split consumed most of the US tour. Martin frequently battled nasty colds and voice exhaustion, which led Coldplay to cancel a series of American dates and scrap a European tour. With all gossip aside, Coldplay resumed playing in Summer 2001 and earned additional success with second single &quot;Trouble&quot;.\r \r By the autumn, they had headed into the studio for a second album. Rumour had it that it might be Coldplay's last album, since the band members felt they might not capture such brilliance again. <em>A Rush of Blood to the Head</em> was released in August 2002. The CD/DVD package <em>Live 2003</em> was issued a year later. Capturing the band's show at the Horden Pavilion in Sydney, <a href=\"http://www.last.fm/place/Australia\" class=\"bbcode_place\">Australia</a>, it highlighted Coldplay's monumental success worldwide with <em>A Rush of Blood to the Head</em>. Martin specifically earned a higher notch on the celebrity scale by marrying actress Gwyneth Paltrow in December 2003. Paltrow gave birth to the couple's first daughter, Apple Blythe Alison Martin, the following April.\r \r Fatherhood did not stop Martin from working, as Coldplay began recording material for a third album within weeks. Previously recorded material with longtime producer Ken Nelson was scrapped early on, while producer Danton Supple (<a href=\"http://www.last.fm/music/Morrissey\" class=\"bbcode_artist\">Morrissey</a>, <a href=\"http://www.last.fm/music/The+Cure\" class=\"bbcode_artist\">The Cure</a>) joined Coldplay to complete the recording of <em>X&amp;Y</em>. &quot;Speed of Sound&quot; marked Coldplay's first single from their long-awaited third effort in Spring 2005; the album followed in June, topping the charts around the world, including America and Britain.\r \r Coldplay's fourth album <em>Viva la Vida or Death and All His Friends</em> was released on June 12, 2008 in the United Kingdom, with the first single <a title=\"Coldplay &ndash; Violet Hill\" href=\"http://www.last.fm/music/Coldplay/_/Violet+Hill\" class=\"bbcode_track\">Violet Hill</a> having been previously released as a free download through their <a href=\"http://www.coldplay.com/\" rel=\"nofollow\">official website</a> for a week from April 29, 2008.\r \r The latest album is currently being given lots of positive feedback for its originality in melodic acoustics and slightly less 'synth-dependent' riffs. It offers a great insight into how significantly the band's music has adapted and developed to themselves and the public.\r \r <em>Viva la Vida</em> was produced by <a href=\"http://www.last.fm/music/Brian+Eno\" class=\"bbcode_artist\">Brian Eno</a>, mixed by Markus Dravs, and drew influence from the time the group spent in South America. \r \r Barely a week before the album was released, a duo with <a href=\"http://www.last.fm/music/Kylie+Minogue\" class=\"bbcode_artist\">Kylie Minogue</a> which was intended to be used was scrapped with the comment that 'it was too sexy'. However, they plan to release it as a single or on a deluxe album expected at around Christmas 2008.\r \r On Dec 1, 2008, Coldplay released &quot;<a href=\"http://video.msn.com/?mkt=en-us&amp;fg=cp_en-us_RED_redwire_launch&amp;vid=51645ad7-8279-4799-a1b9-7607dc546d13\" rel=\"nofollow\">Lhuna</a>&quot; with Kylie Minogue at the launch of the <a href=\"http://red.msn.com/\" rel=\"nofollow\">(RED)WIRE\xE2\x84\xA2</a> website to mark World AIDS Day 2008. This is the world premiere of the song.\r \r Official website: <a href=\"http://www.coldplay.com\" rel=\"nofollow\">www.coldplay.com</a>]]></content>\n </bio>\n </artist></lfm>\n"
65
+ body_exist: true
66
+ code: "200"
67
+ header:
68
+ cache-control:
69
+ - max-age=604800
70
+ connection:
71
+ - close
72
+ expires:
73
+ - Thu, 13 Aug 2009 02:23:39 GMT
74
+ content-type:
75
+ - text/xml; charset=utf-8;
76
+ date:
77
+ - Thu, 06 Aug 2009 02:23:39 GMT
78
+ x-web-node:
79
+ - www70
80
+ x-proxy-fix-up:
81
+ - headers fixed up
82
+ server:
83
+ - Apache/1.3.39 (Unix)
84
+ http_version: "1.0"
85
+ message: OK
86
+ read: true
87
+ socket:
88
+ uri: http://ws.audioscrobbler.com:80/2.0?method=artist.getinfo&artist=coldplay&api_key=TEST
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sandro-metamuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Turriate
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-24 00:00:00 -07:00
12
+ date: 2009-08-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,22 +24,26 @@ extra_rdoc_files:
24
24
  files:
25
25
  - .document
26
26
  - .gitignore
27
+ - History
27
28
  - MIT_LICENSE
28
29
  - README.rdoc
29
30
  - Rakefile
30
31
  - VERSION
31
32
  - lib/array_ext.rb
32
33
  - lib/arrayish.rb
34
+ - lib/hash_ext.rb
33
35
  - lib/httparty_ext.rb
34
36
  - lib/metamuse.rb
35
37
  - lib/metamuse/album.rb
36
38
  - lib/metamuse/artist.rb
37
39
  - lib/metamuse/association.rb
38
40
  - lib/metamuse/collection.rb
41
+ - lib/metamuse/instance_initialize.rb
39
42
  - lib/metamuse/services.rb
40
43
  - lib/metamuse/services/echonest.rb
41
44
  - lib/metamuse/services/freebase.rb
42
45
  - lib/metamuse/services/lastfm.rb
46
+ - lib/metamuse/services/lastfm/artist.rb
43
47
  - lib/metamuse/services/lastfm/image.rb
44
48
  - lib/metamuse/services/music_brainz.rb
45
49
  - lib/metamuse/track.rb
@@ -48,24 +52,26 @@ files:
48
52
  - script/console
49
53
  - spec/fake_object.rb
50
54
  - spec/fake_object_spec.rb
55
+ - spec/hash_ext_spec.rb
51
56
  - spec/metamuse/album_spec.rb
52
57
  - spec/metamuse/artist_spec.rb
53
58
  - spec/metamuse/association_spec.rb
54
59
  - spec/metamuse/collection_spec.rb
55
60
  - spec/metamuse/services/echonest_spec.rb
56
61
  - spec/metamuse/services/freebase_spec.rb
62
+ - spec/metamuse/services/lastfm/artist_spec.rb
57
63
  - spec/metamuse/services/lastfm/image_spec.rb
58
64
  - spec/metamuse/services/lastfm_spec.rb
59
65
  - spec/metamuse/services/music_brainz_spec.rb
60
66
  - spec/metamuse_spec.rb
61
67
  - spec/spec_helper.rb
62
- - spec/web_fixtures/GET_developer.echonest.com-api-search_artists_17a9da1.fixture
63
- - spec/web_fixtures/GET_developer.echonest.com-api-search_artists_350c352.fixture
64
68
  - spec/web_fixtures/GET_musicbrainz.org-ws-1-release-bb32aa1d-f37b-4134-8c0e-b43b7a6dab85_b976ba7.fixture
69
+ - spec/web_fixtures/GET_ws.audioscrobbler.com-2.0_857b5b7.fixture
65
70
  - spec/web_fixtures/GET_www.freebase.com-api-service-mqlread_60ee2bd.fixture
66
71
  - spec/web_fixtures/GET_www.freebase.com-api-service-mqlread_b8b2565.fixture
67
72
  has_rdoc: true
68
73
  homepage: http://github.com/sandro/metamuse
74
+ licenses:
69
75
  post_install_message:
70
76
  rdoc_options:
71
77
  - --charset=UTF-8
@@ -86,19 +92,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
92
  requirements: []
87
93
 
88
94
  rubyforge_project:
89
- rubygems_version: 1.2.0
95
+ rubygems_version: 1.3.5
90
96
  signing_key:
91
97
  specification_version: 2
92
98
  summary: Search for music metadata
93
99
  test_files:
94
100
  - spec/fake_object.rb
95
101
  - spec/fake_object_spec.rb
102
+ - spec/hash_ext_spec.rb
96
103
  - spec/metamuse/album_spec.rb
97
104
  - spec/metamuse/artist_spec.rb
98
105
  - spec/metamuse/association_spec.rb
99
106
  - spec/metamuse/collection_spec.rb
100
107
  - spec/metamuse/services/echonest_spec.rb
101
108
  - spec/metamuse/services/freebase_spec.rb
109
+ - spec/metamuse/services/lastfm/artist_spec.rb
102
110
  - spec/metamuse/services/lastfm/image_spec.rb
103
111
  - spec/metamuse/services/lastfm_spec.rb
104
112
  - spec/metamuse/services/music_brainz_spec.rb
@@ -1,36 +0,0 @@
1
- --- !ruby/object:FakeWeb::Fixture
2
- file_name: GET_developer.echonest.com-api-search_artists_17a9da1.fixture
3
- method: :get
4
- path: /Users/santuri/Code/Ruby/metamuse/spec/web_fixtures
5
- response: !ruby/object:Net::HTTPOK
6
- body: |-
7
- <?xml version="1.0" encoding="UTF-8"?>
8
- <response version="3"><status><code>1</code><message>Invalid API key</message></status><query><parameter name="api_key">TEST</parameter><parameter name="query">coldplay</parameter><parameter name="exact">N</parameter><parameter name="sounds_like">Y</parameter><parameter name="rows">15</parameter></query></response>
9
- body_exist: true
10
- code: "200"
11
- header:
12
- vary:
13
- - Accept-Encoding
14
- cache-control:
15
- - max-age=0
16
- last-modified:
17
- - Sun, 12 Jul 2009 08:51:18 GMT
18
- connection:
19
- - close
20
- expires:
21
- - Sun, 12 Jul 2009 08:51:18 GMT
22
- content-type:
23
- - text/xml; charset=utf-8
24
- etag:
25
- - "\"009fc576f34f8bcdef29d743a855a3ab\""
26
- date:
27
- - Sun, 12 Jul 2009 08:51:18 GMT
28
- server:
29
- - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_wsgi/2.3
30
- transfer-encoding:
31
- - chunked
32
- http_version: "1.1"
33
- message: OK
34
- read: true
35
- socket:
36
- uri: http://developer.echonest.com:80/api/search_artists?query=coldplay&version=3&api_key=TEST
@@ -1,36 +0,0 @@
1
- --- !ruby/object:FakeWeb::Fixture
2
- file_name: GET_developer.echonest.com-api-search_artists_350c352.fixture
3
- method: :get
4
- path: /Users/santuri/Code/Ruby/metamuse/spec/web_fixtures
5
- response: !ruby/object:Net::HTTPOK
6
- body: |-
7
- <?xml version="1.0" encoding="UTF-8"?>
8
- <response version="3"><status><code>0</code><message>Success</message></status><query><parameter name="api_key">TEST</parameter><parameter name="query">coldplay</parameter><parameter name="exact">N</parameter><parameter name="sounds_like">Y</parameter><parameter name="rows">15</parameter></query><artists><artist><id>music://id.echonest.com/~/AR/ARJ7KF01187B98D717</id><name>Coldplay</name></artist><artist><id>music://id.echonest.com/~/AR/ARWIGKG121318C57F8</id><name>Karaoke - Coldplay</name></artist><artist><id>music://id.echonest.com/~/AR/ARKVUOD121318C5980</id><name>Various Artists - Coldplay Tribute</name></artist></artists></response>
9
- body_exist: true
10
- code: "200"
11
- header:
12
- vary:
13
- - Accept-Encoding
14
- cache-control:
15
- - max-age=0
16
- last-modified:
17
- - Tue, 30 Jun 2009 00:34:55 GMT
18
- connection:
19
- - close
20
- expires:
21
- - Tue, 30 Jun 2009 00:34:55 GMT
22
- content-type:
23
- - text/xml; charset=utf-8
24
- etag:
25
- - "\"0d66ceeff95dc6fb9b64167ab260571d\""
26
- date:
27
- - Tue, 30 Jun 2009 00:34:53 GMT
28
- server:
29
- - Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_wsgi/2.3
30
- transfer-encoding:
31
- - chunked
32
- http_version: "1.1"
33
- message: OK
34
- read: true
35
- socket:
36
- uri: http://developer.echonest.com:80/api/search_artists?version=3&api_key=TEST&query=coldplay