meta-spotify 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5bc48dbd8347ca6e7231f8e8d54937e5e2719eb
4
+ data.tar.gz: d739fa8e68aa0f307566ad54cb986b63b0a27d4c
5
+ SHA512:
6
+ metadata.gz: f54795b5f072778d91732935abded787b990859a8ba955c33e869faf4f0ba49929f9b5d0218e9297749d512b653d424a666a20c00ed9d213ee8086e2766225ac
7
+ data.tar.gz: a74543459db1b0389f454af8483004208fb525f6c20f1170e7ef6ba271ac206e8191d84bcd46946b6e77b08894782020fbf9a265755d644c82b56b80923e15d4
data/HISTORY CHANGED
@@ -1,3 +1,15 @@
1
+ === 0.3.2 / 2014-01-25
2
+
3
+ * 1 minor update
4
+
5
+ * Exposes track ISRC
6
+
7
+ === 0.3.1 / 2013-03-16
8
+
9
+ * 1 minor update
10
+
11
+ * Proper query string submission
12
+
1
13
  === 0.3.0 / 2012-10-9
2
14
 
3
15
  * 1 minor update
@@ -59,4 +71,4 @@ Also removed Jeweler and dependency on Crack.
59
71
 
60
72
  * 1 major enhancement
61
73
 
62
- * First release
74
+ * First release
@@ -1,17 +1,19 @@
1
1
  module MetaSpotify
2
2
  class Track < MetaSpotify::Base
3
-
3
+
4
4
  def self.uri_regex
5
5
  /^spotify:track:([A-Za-z0-9]+)$/
6
6
  end
7
-
7
+
8
8
  attr_reader :album, :artists, :track_number, :length,
9
- :musicbrainz_id, :musicbrainz_uri, :allmusic_id, :allmusic_uri
10
-
9
+ :musicbrainz_id, :musicbrainz_uri, :allmusic_id, :allmusic_uri,
10
+ :isrc_id
11
+
11
12
  def initialize(hash)
12
13
  @name = hash['name']
13
14
  @uri = hash['href'] if hash.has_key? 'href'
14
15
  @popularity = hash['popularity'].to_f if hash.has_key? 'popularity'
16
+
15
17
  if hash.has_key? 'artist'
16
18
  @artists = []
17
19
  if hash['artist'].is_a? Array
@@ -20,21 +22,17 @@ module MetaSpotify
20
22
  @artists << Artist.new(hash['artist'])
21
23
  end
22
24
  end
25
+
23
26
  @album = Album.new(hash['album']) if hash.has_key? 'album'
24
27
  @track_number = hash['track_number'].to_i if hash.has_key? 'track_number'
25
28
  @length = hash['length'].to_f if hash.has_key? 'length'
26
-
27
- if hash['id'].is_a? Array
28
-
29
+
30
+ case hash['id']
31
+ when Hash
32
+ node_to_id hash['id']
33
+ when Array
29
34
  hash['id'].each do |id|
30
- case id['type']
31
- when 'mbid' then
32
- @musicbrainz_id = id['__content__']
33
- @musicbrainz_uri = id['href']
34
- when 'amgid' then
35
- @allmusic_id = id
36
- @allmusic_uri = id['href']
37
- end
35
+ node_to_id id
38
36
  end
39
37
  end
40
38
  end
@@ -43,5 +41,18 @@ module MetaSpotify
43
41
  "http://open.spotify.com/track/#{spotify_id}"
44
42
  end
45
43
 
44
+ private
45
+ def node_to_id(node)
46
+ case node['type']
47
+ when 'mbid' then
48
+ @musicbrainz_id = node['__content__']
49
+ @musicbrainz_uri = node['href']
50
+ when 'amgid' then
51
+ @allmusic_id = node
52
+ @allmusic_uri = node['href']
53
+ when 'isrc' then
54
+ @isrc_id = node['__content__']
55
+ end
56
+ end
46
57
  end
47
58
  end
@@ -1,3 +1,3 @@
1
1
  module MetaSpotify
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -55,6 +55,7 @@ class TestTrack < Test::Unit::TestCase
55
55
  assert_equal "e230c541-78fb-4d08-99c9-ebcb111d7058", @result.musicbrainz_id
56
56
  assert_equal "http://www.allmusic.com/cg/amg.dll?p=amg&sql=33:jifqxvlhldde", @result.allmusic_uri
57
57
  assert_equal '3zBhJBEbDD4a4SO1EaEiBP', @result.spotify_id
58
+ assert_equal 'GBBKS9900090', @result.isrc_id
58
59
  assert_equal 'http://open.spotify.com/track/3zBhJBEbDD4a4SO1EaEiBP', @result.http_uri
59
60
  end
60
61
  should "create an album object for that track" do
metadata CHANGED
@@ -1,52 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta-spotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
5
- prerelease:
4
+ version: 0.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Phil Nash
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-16 00:00:00.000000000 Z
11
+ date: 2014-01-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
- requirement: &70318309136740 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>'
17
+ - - '>'
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0.8'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70318309136740
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>'
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: shoulda
27
- requirement: &70318309132920 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: 2.10.2
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70318309132920
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.10.2
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: fakeweb
38
- requirement: &70318309142920 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: 1.2.4
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *70318309142920
47
- description: ! "A ruby wrapper for the Spotify Metadata API.\n See
48
- https://developer.spotify.com/technologies/web-api/\n for
49
- API documentation."
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.4
55
+ description: |-
56
+ A ruby wrapper for the Spotify Metadata API.
57
+ See https://developer.spotify.com/technologies/web-api/
58
+ for API documentation.
50
59
  email:
51
60
  - philnash@gmail.com
52
61
  executables: []
@@ -81,27 +90,26 @@ files:
81
90
  - test/test_track.rb
82
91
  homepage: http://github.com/philnash/meta-spotify
83
92
  licenses: []
93
+ metadata: {}
84
94
  post_install_message:
85
95
  rdoc_options: []
86
96
  require_paths:
87
97
  - lib
88
98
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
99
  requirements:
91
- - - ! '>='
100
+ - - '>='
92
101
  - !ruby/object:Gem::Version
93
102
  version: '0'
94
103
  required_rubygems_version: !ruby/object:Gem::Requirement
95
- none: false
96
104
  requirements:
97
- - - ! '>='
105
+ - - '>='
98
106
  - !ruby/object:Gem::Version
99
107
  version: '0'
100
108
  requirements: []
101
109
  rubyforge_project:
102
- rubygems_version: 1.8.11
110
+ rubygems_version: 2.0.3
103
111
  signing_key:
104
- specification_version: 3
112
+ specification_version: 4
105
113
  summary: A ruby wrapper for the Spotify Metadata API
106
114
  test_files:
107
115
  - test/fixtures/album.xml