Revisions
-
borzilleri revised this gist
Nov 12, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/usr/bin/ruby # https://gist.github.com/1361100 ID3_TAGS = { "TITLE" => "tt", -
borzilleri revised this gist
Nov 12, 2011 . 1 changed file with 55 additions and 12 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,61 @@ #!/usr/bin/ruby # http://gist.github.com/gists/124242 ID3_TAGS = { "TITLE" => "tt", "ARTIST" => "ta", "ALBUM" => "tl", "DATE" => "ty", "GENRE" => "tg", "TRACKNUMBER" => "tn", } CUSTOM_TAGS = { "COMPOSER" => "TCOM", "DISCNUMBER" => "TPOS", } #ARGV.each do|filename| Dir["*.flac"].each do |filename| abort "Usage: flac2mp3 FLACFILE" if filename.nil? tags = Hash.new custom = Hash.new trackTotal = 0 discTotal = 0 `metaflac --export-tags-to=- "#{filename}"`.each_line do |s| v=s.strip.split '=', 2 v[0].upcase! v[1].gsub! '"', '\"' if ID3_TAGS.has_key?(v[0]) tags[ID3_TAGS[v[0]]] = v[1] elsif CUSTOM_TAGS.has_key?(v[0]) custom[CUSTOM_TAGS[v[0]]] = v[1] elsif "TRACKTOTAL" == v[0] trackTotal = v[1] elsif "DISCTOTAL" discTotal = v[1] end end if tags.has_key?("tn") and 0 != trackTotal tags["tn"] += "/#{trackTotal}" end if custom.has_key?("TPOS") and 0 != discTotal custom["TPOS"] += "/#{discTotal}" end id3args = "" tags.each do |arg,val| id3args += %Q[ --#{arg} "#{val}"] end custom.each do |id,val| id3args += %Q[ --tv "#{id}=#{val}"] end basename=File.basename(filename, File.extname(filename)) puts "Encoding #{basename}.mp3" cmd = %Q[flac -sdc "#{filename}" | lame -V0 #{id3args} - "#{basename}.mp3"] system cmd end -
mxcl revised this gist
Jul 4, 2009 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,10 +5,10 @@ filename=ARGV[0] abort "Usage: flac2mp3 FLACFILE" if filename.nil? `metaflac --export-tags-to=- "#{filename}"`.each_line do |s| v=s.strip.split '=', 2 v[0].upcase! v[1].gsub! '"', '\"' eval %Q[#{v[0]}="#{v[1]}"]; end args=%Q[--tt "#{TITLE}" --ta "#{ARTIST}" --tl "#{ALBUM}" --tn "#{TRACKNUMBER}" --tg "#{GENRE}"] -
mxcl revised this gist
Jun 5, 2009 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,4 +14,5 @@ end args=%Q[--tt "#{TITLE}" --ta "#{ARTIST}" --tl "#{ALBUM}" --tn "#{TRACKNUMBER}" --tg "#{GENRE}"] basename=File.basename(filename, File.extname(filename)) puts "Encoding #{basename}.mp3" exec %Q[flac -sdc "#{filename}" | lame --alt-preset standard #{args} - "#{basename}.mp3"] -
mxcl revised this gist
Jun 5, 2009 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ #!/usr/bin/ruby # http://gist.github.com/gists/124242 filename=ARGV[0] abort "Usage: flac2mp3 FLACFILE" if filename.nil? `metaflac --export-tags-to=- "#{filename}"`.each_line do |s| s.strip! s.gsub! '"', '\"' s.sub! '=', '="' eval s+'"' end args=%Q[--tt "#{TITLE}" --ta "#{ARTIST}" --tl "#{ALBUM}" --tn "#{TRACKNUMBER}" --tg "#{GENRE}"] -
mxcl created this gist
Jun 5, 2009 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/usr/bin/ruby # Author: Max Howell http://www.methylblue.com filename=ARGV[0] abort "Usage: flac2mp3 FLACFILE" if filename.nil? `metaflac --export-tags-to=- "#{filename}"`.each_line do |s| s.gsub! '"', '\"' s.sub! '=', '="' s.sub! "\n", "\"\n" eval s end args=%Q[--tt "#{TITLE}" --ta "#{ARTIST}" --tl "#{ALBUM}" --tn "#{TRACKNUMBER}" --tg "#{GENRE}"] basename=File.basename(filename, File.extname(filename)) exec %Q[flac -sdc "#{filename}" | lame --alt-preset standard #{args} --disptime - "#{basename}.mp3"]