sweeper 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/lib/sweeper.rb +14 -7
- data/sweeper.gemspec +2 -2
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/lib/sweeper.rb
CHANGED
@@ -94,7 +94,7 @@ class Sweeper
|
|
94
94
|
|
95
95
|
rescue Problem => e
|
96
96
|
tries += 1 and retry if tries < 2
|
97
|
-
puts "Skipped (#{e.message}): #{File.basename(filename)}"
|
97
|
+
puts "Skipped (#{e.message.gsub('\n', ' ')}): #{File.basename(filename)}"
|
98
98
|
@failed += 1
|
99
99
|
end
|
100
100
|
end
|
@@ -154,16 +154,16 @@ class Sweeper
|
|
154
154
|
response = `./#{File.basename(binary)} #{filename.inspect} 2> #{@errf.path}`
|
155
155
|
object = begin
|
156
156
|
XSD::Mapping.xml2obj(response)
|
157
|
-
rescue
|
158
|
-
raise Problem, "
|
157
|
+
rescue Object => e
|
158
|
+
raise Problem, "#{e.class.name} - #{e.message}"
|
159
159
|
end
|
160
|
-
raise Problem, "Fingerprint failed
|
160
|
+
raise Problem, "Fingerprint failed" unless object
|
161
161
|
|
162
162
|
tags = {}
|
163
163
|
song = Array(object.track).first
|
164
164
|
|
165
165
|
BASIC_KEYS.each do |key|
|
166
|
-
tags[key] = song.send(key) if song.respond_to? key
|
166
|
+
tags[key] = song.send(key) if song.respond_to? key
|
167
167
|
end
|
168
168
|
tags
|
169
169
|
end
|
@@ -175,11 +175,18 @@ class Sweeper
|
|
175
175
|
|
176
176
|
response = begin
|
177
177
|
open("http://ws.audioscrobbler.com/1.0/artist/#{URI.encode(tags['artist'])}/toptags.xml").read
|
178
|
-
rescue
|
178
|
+
rescue Object => e
|
179
|
+
puts "Open-URI error: #{e.class.name} - #{e.message}" if ENV['DEBUG']
|
179
180
|
return DEFAULT_GENRE
|
180
181
|
end
|
181
182
|
|
182
|
-
|
183
|
+
begin
|
184
|
+
object = XSD::Mapping.xml2obj(response)
|
185
|
+
rescue Object => e
|
186
|
+
puts "XSD error: #{e.class.name} - #{e.message}" if ENV['DEBUG']
|
187
|
+
return DEFAULT_GENRE
|
188
|
+
end
|
189
|
+
|
183
190
|
return DEFAULT_GENRE if !object.respond_to? :tag
|
184
191
|
|
185
192
|
genres = Array(object.tag)[0..(GENRE_COUNT - 1)].map(&:name)
|
data/sweeper.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Sweeper-0.2.
|
2
|
+
# Gem::Specification for Sweeper-0.2.4
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{sweeper}
|
7
|
-
s.version = "0.2.
|
7
|
+
s.version = "0.2.4"
|
8
8
|
|
9
9
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
10
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|