Created
August 28, 2012 17:45
-
-
Save lenage/3501315 to your computer and use it in GitHub Desktop.
Get mp3info from a fold use ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mp3info' | |
dir = File.expand_path("../", __FILE__) | |
Dir["#{dir}/*"].each do |sub_dir| | |
if File.directory?(sub_dir) | |
Dir.entries(sub_dir).each do |file| | |
if file =~ /mp3/ | |
title = file.split("-").last.sub(/.mp3/, "") | |
artist = file.scan(/_(\w+)/).flatten.first | |
Mp3Info.open( sub_dir + "/" + file ) do |mp3| | |
mp3.tag.title = title | |
mp3.tag.artist = artist | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment