Skip to content

Instantly share code, notes, and snippets.

@jdudek jdudek/import.rb
Created Jun 1, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.