Class: WahWah::ID3::CommentFrameBody

Inherits:
FrameBody
  • Object
show all
Defined in:
lib/wahwah/id3/comment_frame_body.rb

Direct Known Subclasses

LyricsFrameBody

Constant Summary

Constants inherited from FrameBody

FrameBody::ENCODING_MAPPING, FrameBody::ENCODING_TERMINATOR_SIZE

Instance Attribute Summary

Attributes inherited from FrameBody

#value

Instance Method Summary collapse

Methods inherited from FrameBody

#initialize

Constructor Details

This class inherits a constructor from WahWah::ID3::FrameBody

Instance Method Details

#parseObject

Comment frame body structure:

Text encoding $xx Language $xx xx xx Short content description <textstring> $00 (00) The actual text <textstring>



12
13
14
15
16
17
18
# File 'lib/wahwah/id3/comment_frame_body.rb', line 12

def parse
  encoding_id, _language, reset_content = @content.unpack("CA3a*")
  encoding = ENCODING_MAPPING[encoding_id]
  _description, comment_text = Helper.split_with_terminator(reset_content, ENCODING_TERMINATOR_SIZE[encoding])

  @value = Helper.encode_to_utf8(comment_text, source_encoding: encoding)
end