Module: FixLameId3GeneratedByK3b

Defined in:
lib/fix-lame-id3-generated-by-k3b.rb,
lib/fix-lame-id3-generated-by-k3b/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#fix(*files) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fix-lame-id3-generated-by-k3b.rb', line 5

def fix(*files)
  files.each do |f|
    tag = Mp3Info.open(f).tag
    begin
      Mp3Info.open(f, encoding: 'utf-8') do |mp3|
        tag.each {|k, v| mp3.tag[k] = v.force_encoding('utf-8') if v.is_a? String }
      end
    rescue
      puts "Skipped file (it has been already fixed probably): #{f}"
    end
  end
end