Skip to content

Instantly share code, notes, and snippets.

@jdudek
Created June 1, 2011 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdudek/1003620 to your computer and use it in GitHub Desktop.
Save jdudek/1003620 to your computer and use it in GitHub Desktop.
csv = File.open("index.csv", "w")
Dir.glob("in/*").each_with_index do |path, i|
file = path.gsub("in/", "").gsub(/\.wav$/, "")
index = i + 1
difficulty = case file
when /^latwe/
1
when /^srednie/
2
when /^trudne/
3
end
artist, title = file.gsub(/^(latwe|srednie|trudne)_/, "").split(" - ")
puts "#{difficulty} | #{artist} | #{title} (#{file})"
system("lame '#{path}' 'out/#{index}.mp3'")
csv << [index, index, artist, title, difficulty].map { |s| '"' + s.to_s + '"' }.join(";") + "\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment