Skip to content

Instantly share code, notes, and snippets.

@aont

aont/id3-utf16.rb

Created Jul 9, 2011
Embed
What would you like to do?
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