Class: TagLib::ID3v2::Tag
Overview
An ID3v2 tag. A tag consists of a list of frames, identified by IDs.
Encoding
By default, taglib stores ID3v2 text frames as ISO-8859-1 (Latin-1) if the text contains only characters that are available in that encoding. If not (e.g. with Cyrillic, Chinese, Japanese), it prints a warning and stores the text as UTF-8.
When you already know that you want to store the text as UTF-8, you can change the default text encoding:
frame_factory = TagLib::ID3v2::FrameFactory.instance
frame_factory.default_text_encoding = TagLib::String::UTF8
Another option is using the frame API directly:
title = tag.frame_list('TIT2').first
title.text = "Joga"
title.text_encoding = TagLib::String::UTF8
Instance Attribute Summary
Attributes inherited from Tag
#album, #artist, #comment, #genre, #title, #track, #year
Instance Method Summary collapse
-
#add_frame(frame) ⇒ void
Add a frame to the tag.
-
#frame_list ⇒ Array<TagLib::ID3v2::Frame>
Get a list of frames.
-
#remove_frame(frame) ⇒ void
Remove the passed frame from the tag.
-
#remove_frames(id) ⇒ void
Remove all frames with the specified ID from the tag.
Methods inherited from Tag
Instance Method Details
#add_frame(frame) ⇒ void
This method returns an undefined value.
Add a frame to the tag.
90 91 |
# File 'docs/taglib/id3v2.rb', line 90 def add_frame(frame) end |
#frame_list ⇒ Array<TagLib::ID3v2::Frame> #frame_list(frame_id) ⇒ Array<TagLib::ID3v2::Frame>
Get a list of frames.
Note that the frames returned are subclasses of Frame, depending on the frame ID. But it's also possible that a UnknownFrame is returned (e.g. when TagLib discards a deprecated frame). So to make sure your code can handle all the cases, it should include a check for the returned class of the frame.
83 84 |
# File 'docs/taglib/id3v2.rb', line 83 def frame_list end |
#remove_frame(frame) ⇒ void
This method returns an undefined value.
Remove the passed frame from the tag.
Note: You can and shall not call any methods on the frame object after you have passed it to this method, because the underlying C++ object has been deleted.
101 102 |
# File 'docs/taglib/id3v2.rb', line 101 def remove_frame(frame) end |
#remove_frames(id) ⇒ void
This method returns an undefined value.
Remove all frames with the specified ID from the tag.
Note: If you have obtained any frame objects with the same ID from the tag before calling this method, you should not touch them anymore. The reason is that the C++ objects may have been deleted.
112 113 |
# File 'docs/taglib/id3v2.rb', line 112 def remove_frames(id) end |