Skip to content

Instantly share code, notes, and snippets.

@dce
Created April 12, 2011 03:33
Show Gist options
  • Save dce/914868 to your computer and use it in GitHub Desktop.
Save dce/914868 to your computer and use it in GitHub Desktop.
convert a bunch of FLAC files to MP3
require "rubygems"
require "mp3info"
`ls -1 *.flac`.split(/\n/).each do |flac|
filename = flac.gsub("flac", "mp3")
`flac -d -c "#{flac}" | lame - converted/"#{filename}"`
Mp3Info.open("converted/#{filename}") do |mp3|
mp3.tag.title = filename[16..-5]
mp3.tag.artist = "Artist"
mp3.tag.album = "Album"
mp3.tag.tracknum = filename[0, 2].to_i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment