Skip to content

Instantly share code, notes, and snippets.

@aont
Created July 9, 2011 11:21
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 aont/1073526 to your computer and use it in GitHub Desktop.
Save aont/1073526 to your computer and use it in GitHub Desktop.
id3lib-ruby utf16
#!/usr/bin/ruby
require 'rubygems'
require 'id3lib'
require "kconv"
class MyID3Tag < ID3Lib::Tag
def title=(v)
self.set_frame_text(:TIT2, v.toutf16)
self.frame(:TIT2)[:textenc] = 1
end
def album=(v)
self.set_frame_text(:TALB, v.toutf16)
self.frame(:TALB)[:textenc] = 1
end
def artist=(v)
self.set_frame_text(:TPE1, v.toutf16)
self.frame(:TPE1)[:textenc] = 1
end
end
tag = MyID3Tag.new('orig.mp3', ID3Lib::V_ALL)
tag.title = "たいとる"
tag.album="あるばむ"
tag.artist="あーちすと"
tag.track = '5/13'
tag.update!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment