isrc 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,7 @@ Gem::Specification.new do |g|
5
5
  g.authors = ["Michael Bianco"]
6
6
  g.email = ["info@cliffsidedev.com"]
7
7
  g.description = "Pull ISRC codes from PPLK UK's database"
8
- g.summary = "Gem to pull ISRC codes from PPL UK's database. " +
9
- "Match by artist and title."
8
+ g.summary = "Pull ISRC codes from PPLK UK's database"
10
9
  g.homepage = "http://github.com/iloveitaly/isrc"
11
10
 
12
11
  g.files = `git ls-files`.split($\)
@@ -11,7 +11,7 @@ module ISRC
11
11
 
12
12
  class PPLUK
13
13
  def retrieve(opts)
14
- puts "INFO #{opts[:artist]}:#{opts[:title]}"
14
+ # puts "INFO #{opts[:artist]}:#{opts[:title]}"
15
15
  agent = Mechanize.new
16
16
  agent.log = Logger.new "mech.log"
17
17
  agent.user_agent_alias = 'Mac Safari'
@@ -74,7 +74,7 @@ module ISRC
74
74
  end
75
75
 
76
76
  # creates an array representation of the table:
77
- # artist, title, isrc, released, time
77
+ # artist, title, isrc, rights holder, released, time
78
78
  isrc_html = Nokogiri::HTML(isrc_search.body)
79
79
  @matches = isrc_html.css("table[id='T400335881332330323192:ars_form:searchResultsTable'] tbody tr").map do |m|
80
80
  columns = m.css('td')
@@ -110,7 +110,7 @@ module ISRC
110
110
  match_quality = []
111
111
 
112
112
  @matches.each do |song_match|
113
- song_seconds = timestring_to_integer(song_match[4].match(/([0-9]:[0-9]{2})/)[1])
113
+ song_seconds = timestring_to_integer(song_match[5].match(/([0-9]:[0-9]{2})/)[1])
114
114
  match_quality << { :delta => (song_seconds - seconds).abs, :match => song_match }
115
115
  end
116
116
 
@@ -1,3 +1,3 @@
1
1
  module ISRC
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -12,16 +12,22 @@ describe ISRC do
12
12
 
13
13
  it "should correctly handle a single search result" do
14
14
  isrc.retrieve artist: 'Coldplay', title: 'Glass'
15
- isrc.match(time:'5:08')[:isrc].should == 'GBAYE0800410'
15
+ isrc.match(time:'5:08')[:isrc].should == 'GBAYE0800410'
16
16
  end
17
17
 
18
- it "should handle songs with multiple results" do
19
- isrc.retrieve artist:'Soul II Soul', title: 'Back To Life (However Do You Want Me) (Club Mix)'
20
- isrc.match(time:'7:39')[:isrc].should == 'GBAAA8900153'
18
+ context "should handle songs with multiple results" do
19
+ it "when the results have the same title and time code" do
20
+ isrc.retrieve artist:'Parade', title:'Louder'
21
+ isrc.match(time:'2:53')[:isrc].should == 'GBAHS1000333'
22
+ end
21
23
 
22
- # the better match seems to be: GB1209500610
23
- # however, the length delta is huge
24
+ it "when there are multiple results, but all with different names" do
25
+ isrc.retrieve artist:'Soul II Soul', title: 'Back To Life (However Do You Want Me) (Club Mix)'
26
+ isrc.match(time:'7:39')[:isrc].should == 'GBAAA8900153'
24
27
 
28
+ # the better match seems to be: GB1209500610
29
+ # however, the length delta is huge
30
+ end
25
31
  end
26
32
 
27
33
  it "should handle songs with no results" do
metadata CHANGED
@@ -1,96 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isrc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
4
  prerelease:
5
+ version: 1.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Bianco
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-18 00:00:00.000000000 Z
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: httparty
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
20
+ none: false
21
+ name: httparty
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
24
+ requirement: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: nokogiri
32
- requirement: !ruby/object:Gem::Requirement
33
29
  none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
34
32
  requirements:
35
33
  - - ! '>='
36
34
  - !ruby/object:Gem::Version
37
35
  version: '0'
36
+ none: false
37
+ name: nokogiri
38
38
  type: :runtime
39
39
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
40
+ requirement: !ruby/object:Gem::Requirement
42
41
  requirements:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: mechanize
48
- requirement: !ruby/object:Gem::Requirement
49
45
  none: false
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
50
48
  requirements:
51
49
  - - ! '>='
52
50
  - !ruby/object:Gem::Version
53
51
  version: '0'
52
+ none: false
53
+ name: mechanize
54
54
  type: :runtime
55
55
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
56
+ requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - ! '>='
60
59
  - !ruby/object:Gem::Version
61
60
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: rspec
64
- requirement: !ruby/object:Gem::Requirement
65
61
  none: false
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
66
64
  requirements:
67
65
  - - ! '>='
68
66
  - !ruby/object:Gem::Version
69
67
  version: '0'
68
+ none: false
69
+ name: rspec
70
70
  type: :development
71
71
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
72
+ requirement: !ruby/object:Gem::Requirement
74
73
  requirements:
75
74
  - - ! '>='
76
75
  - !ruby/object:Gem::Version
77
76
  version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: guard
80
- requirement: !ruby/object:Gem::Requirement
81
77
  none: false
78
+ - !ruby/object:Gem::Dependency
79
+ version_requirements: !ruby/object:Gem::Requirement
82
80
  requirements:
83
81
  - - ! '>='
84
82
  - !ruby/object:Gem::Version
85
83
  version: '0'
84
+ none: false
85
+ name: guard
86
86
  type: :development
87
87
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
88
+ requirement: !ruby/object:Gem::Requirement
90
89
  requirements:
91
90
  - - ! '>='
92
91
  - !ruby/object:Gem::Version
93
92
  version: '0'
93
+ none: false
94
94
  description: Pull ISRC codes from PPLK UK's database
95
95
  email:
96
96
  - info@cliffsidedev.com
@@ -117,23 +117,23 @@ rdoc_options: []
117
117
  require_paths:
118
118
  - lib
119
119
  required_ruby_version: !ruby/object:Gem::Requirement
120
- none: false
121
120
  requirements:
122
121
  - - ! '>='
123
122
  - !ruby/object:Gem::Version
124
123
  version: '0'
125
- required_rubygems_version: !ruby/object:Gem::Requirement
126
124
  none: false
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
126
  requirements:
128
127
  - - ! '>='
129
128
  - !ruby/object:Gem::Version
130
129
  version: '0'
130
+ none: false
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 1.8.24
133
+ rubygems_version: 1.8.23
134
134
  signing_key:
135
135
  specification_version: 3
136
- summary: Gem to pull ISRC codes from PPL UK's database. Match by artist and title.
136
+ summary: Pull ISRC codes from PPLK UK's database
137
137
  test_files:
138
138
  - spec/isrc_spec.rb
139
139
  - spec/spec_helper.rb