sweeper 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
- v0.2.1. Better error handling.
2
+ v0.2.2. Avoid error with too many open files.
3
+
4
+ v0.2.1. Better error handling; smarter genre choosing.
3
5
 
4
6
  v0.2. Genre tagging; bugfixes.
5
7
 
data/README CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ Sweeper
3
+
2
4
  Automatically tag your music collection with metadata from Last.fm.
3
5
 
4
6
  == License
@@ -34,9 +36,11 @@ Now, change to the directory of mp3s you want to tag and run:
34
36
 
35
37
  Your mp3s will be updated with missing artist, genre, and trackname information, and a list of all tagged genres will be added to the <tt>comment</tt> field, for use in smart playlists.
36
38
 
39
+ You do not need a Last.fm account to use Sweeper.
40
+
37
41
  == Demo
38
42
 
39
- Unknown song before sweeping:
43
+ Unknown song:
40
44
 
41
45
  $ id3info 1_001.mp3
42
46
  *** Tag information for 1_001.mp3
@@ -80,3 +84,7 @@ You will get cleaner tags if you convert your files to ID3v2 first. Sweeper read
80
84
  The support forum is here[http://rubyforge.org/forum/forum.php?forum_id=23599].
81
85
 
82
86
  Patches and contributions are very welcome. Please note that contributors are required to assign copyright for their additions to Cloudburst, LLC.
87
+
88
+ == Further resources
89
+
90
+ * http://blog.evanweaver.com/articles/2008/04/13/sweeper/
data/lib/sweeper.rb CHANGED
@@ -36,6 +36,8 @@ class Sweeper
36
36
  def initialize(options = {})
37
37
  @dir = File.expand_path(options['dir'] || Dir.pwd)
38
38
  @options = options
39
+ @outf = Tempfile.new("stdout")
40
+ @errf = Tempfile.new("stderr")
39
41
  end
40
42
 
41
43
  # Run the Sweeper according to the <tt>options</tt>.
@@ -149,7 +151,7 @@ class Sweeper
149
151
  # Lookup the basic metadata for an mp3 file. Accepts a pathname. Returns a tag hash.
150
152
  def lookup_basic(filename)
151
153
  Dir.chdir File.dirname(binary) do
152
- response = silence { `./#{File.basename(binary)} #{filename.inspect}` }
154
+ response = `./#{File.basename(binary)} #{filename.inspect} 2> #{@errf.path}`
153
155
  object = begin
154
156
  XSD::Mapping.xml2obj(response)
155
157
  rescue REXML::ParseException
@@ -246,21 +248,4 @@ class Sweeper
246
248
  ID3Lib::Tag.new(filename, ID3Lib::V_ALL)
247
249
  end
248
250
 
249
- # Silence STDERR and STDOUT for the duration of the block.
250
- def silence(outf = nil, errf = nil)
251
- # This method is annoying.
252
- outf, errf = Tempfile.new("stdout"), Tempfile.new("stderr")
253
- out, err = $stdout.clone, $stderr.clone
254
- $stdout.reopen(outf)
255
- $stderr.reopen(errf)
256
- begin
257
- yield
258
- ensure
259
- $stdout.reopen(out)
260
- $stderr.reopen(err)
261
- outf.close; outf.unlink
262
- errf.close; errf.unlink
263
- end
264
- end
265
-
266
251
  end
data/sweeper.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
- # Gem::Specification for Sweeper-0.2.1
2
+ # Gem::Specification for Sweeper-0.2.2
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.1"
7
+ s.version = "0.2.2"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
@@ -49,9 +49,7 @@ class SweeperTest < Test::Unit::TestCase
49
49
  end
50
50
 
51
51
  def test_write
52
- @s.silence do
53
- @s.write(@found_many, @s.lookup(@found_many))
54
- end
52
+ @s.write(@found_many, @s.lookup(@found_many))
55
53
  assert_equal(
56
54
  @s.lookup(@found_many),
57
55
  @s.read(@found_many))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
metadata.gz.sig CHANGED
Binary file