meta-spotify 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +6 -0
- data/VERSION +1 -1
- data/lib/meta-spotify/track.rb +16 -1
- data/meta-spotify.gemspec +2 -2
- data/test/test_track.rb +2 -0
- metadata +2 -2
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/meta-spotify/track.rb
CHANGED
@@ -3,7 +3,8 @@ module MetaSpotify
|
|
3
3
|
|
4
4
|
URI_REGEX = /^spotify:track:[A-Za-z0-9]+$/
|
5
5
|
|
6
|
-
attr_reader :album, :artists, :track_number, :length
|
6
|
+
attr_reader :album, :artists, :track_number, :length,
|
7
|
+
:musicbrainz_id, :musicbrainz_uri, :allmusic_id, :allmusic_uri
|
7
8
|
|
8
9
|
def initialize(hash)
|
9
10
|
@name = hash['name']
|
@@ -20,6 +21,20 @@ module MetaSpotify
|
|
20
21
|
@album = Album.new(hash['album']) if hash.has_key? 'album'
|
21
22
|
@track_number = hash['track_number'].to_i if hash.has_key? 'track_number'
|
22
23
|
@length = hash['length'].to_f if hash.has_key? 'length'
|
24
|
+
|
25
|
+
if hash['id'].is_a? Array
|
26
|
+
|
27
|
+
hash['id'].each do |id|
|
28
|
+
case id.attributes['type']
|
29
|
+
when 'mbid' then
|
30
|
+
@musicbrainz_id = id
|
31
|
+
@musicbrainz_uri = id.attributes['href']
|
32
|
+
when 'amgid' then
|
33
|
+
@allmusic_id = id
|
34
|
+
@allmusic_uri = id.attributes['href']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
23
38
|
end
|
24
39
|
end
|
25
40
|
end
|
data/meta-spotify.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{meta-spotify}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Phil Nash"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-12-19}
|
13
13
|
s.email = %q{philnash@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
data/test/test_track.rb
CHANGED
@@ -46,6 +46,8 @@ class TestTrack < Test::Unit::TestCase
|
|
46
46
|
assert_equal 345, @result.length
|
47
47
|
assert_equal 0.51368, @result.popularity
|
48
48
|
assert_equal TRACK_URI, @result.uri
|
49
|
+
assert_equal "e230c541-78fb-4d08-99c9-ebcb111d7058", @result.musicbrainz_id
|
50
|
+
assert_equal "http://www.allmusic.com/cg/amg.dll?p=amg&sql=33:jifqxvlhldde", @result.allmusic_uri
|
49
51
|
end
|
50
52
|
should "create an album object for that track" do
|
51
53
|
assert_kind_of MetaSpotify::Album, @result.album
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta-spotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Nash
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-19 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|