Permalink
Browse files

Parse a folder of MP3.

  • Loading branch information...
1 parent e4d7b0c commit e34d5ae3362667d3b389287a773708e3c38242f4 @athoune committed Oct 28, 2011
Showing with 8 additions and 3 deletions.
  1. +3 −1 bin/terasound
  2. +5 −2 lib/terasound/echoprint.rb
View
@@ -2,4 +2,6 @@
require "terasound/echoprint"
-p TeraSound.codegen ARGV[0]
+TeraSound.codegen(ARGV[0]) do |mp3|
+ p mp3
+end
@@ -2,8 +2,11 @@
module TeraSound
- def TeraSound.codegen path
- JSON.parse `find #{path} -name "*.mp3" | echoprint-codegen -s 10 30`
+ # Parse a folder and extract mp3 data
+ def TeraSound.codegen path, &block
+ Dir["#{path}/**/*.mp3"].each do |mp3|
+ yield JSON.parse(`echoprint-codegen "#{mp3}" 10 30`)[0]
+ end
end
end

0 comments on commit e34d5ae

Please sign in to comment.