Class: ID3Tag::Frames::V2::PictureFrame

Inherits:
BasicFrame
  • Object
show all
Defined in:
lib/id3tag/frames/v2/picture_frame.rb

Constant Summary collapse

'-->'
IMPLIED_MIME_TYPE =
'image/'
TYPES =
{
  0x00 => :other, # Other
  0x01 => :file_icon_png32, # 32x32 pixels 'file icon' (PNG only)
  0x02 => :file_icon, # Other file icon
  0x03 => :cover_front, # Cover (front)
  0x04 => :cover_back, # Cover (back)
  0x05 => :leaflet_page, # Leaflet page
  0x06 => :media, # Media (e.g. lable side of CD)
  0x07 => :lead_artist, # Lead artist/lead performer/soloist
  0x08 => :artist, # Artist/performer
  0x09 => :conductor, # Conductor
  0x0a => :band, # Band/Orchestra
  0x0b => :composer, # Composer
  0x0c => :lyricist, # Lyricist/text writer
  0x0d => :recording_location, # Recording Location
  0x0e => :during_recording, # During recording
  0x0f => :during_performance, # During performance
  0x10 => :movie_screen_capture, # Movie/video screen capture
  0x11 => :fish, # A bright coloured fish
  0x12 => :illustration, # Illustration
  0x13 => :band_logotype, # Band/artist logotype
  0x14 => :publisher_logotype # Publisher/Studio logotype
}

Constants inherited from BasicFrame

BasicFrame::DECOMPRESSED_SIZE_BYTE_COUNT, BasicFrame::GROUP_BYTE_COUNT

Instance Attribute Summary

Attributes inherited from BasicFrame

#id, #raw_content

Instance Method Summary collapse

Methods inherited from BasicFrame

#compressed?, #data_length_indicator?, #encrypted?, #encryption_id, #final_size, #group_id, #grouped?, #initialize, #inspect, #inspectable_content, #preserve_on_file_alteration?, #preserve_on_tag_alteration?, #read_additional_info_byte, #read_only?, #unsynchronised?, #usable_content

Constructor Details

This class inherits a constructor from ID3Tag::Frames::V2::BasicFrame

Instance Method Details

#contentObject



62
63
64
# File 'lib/id3tag/frames/v2/picture_frame.rb', line 62

def content
  data
end

#dataObject



66
67
68
# File 'lib/id3tag/frames/v2/picture_frame.rb', line 66

def data
  parts[:data]
end

#descriptionObject



57
58
59
60
# File 'lib/id3tag/frames/v2/picture_frame.rb', line 57

def description
  encoding = get_encoding
  EncodingUtil.encode(parts[:description], encoding)
end

#link?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/id3tag/frames/v2/picture_frame.rb', line 49

def link?
  mime_type == LINK_SYMBOL
end

#mime_typeObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/id3tag/frames/v2/picture_frame.rb', line 31

def mime_type
  if @major_version_number > 2
    result = parts[:mime_type]
    if StringUtil.blank?(result.strip)
      IMPLIED_MIME_TYPE
    else
      result
    end
  else
    image_format = parts[:mime_type].downcase
    if StringUtil.blank?(image_format.strip)
      IMPLIED_MIME_TYPE
    else
      IMPLIED_MIME_TYPE + image_format
    end
  end
end

#typeObject



53
54
55
# File 'lib/id3tag/frames/v2/picture_frame.rb', line 53

def type
  TYPES[parts[:picture_type_byte]]
end