Class: TagLib::FLAC::File

Inherits:
TagLib::File show all
Defined in:
docs/taglib/flac.rb

Overview

The file class for .flac files.

Note that Xiph comments is the primary tagging format for FLAC files. When saving a file, if there's not yet a Xiph comment, it is created from existing ID3 tags. ID3 tags will be updated if they exist, but not created automatically.

Examples:

Reading Xiph comments

TagLib::FLAC::File.open("file.flac") do |file|
  tag = file.xiph_comment
  puts tag.title
  fields = tag.field_list_map
  puts fields['DATE']
end

Adding a picture

TagLib::FLAC::File.open("file.flac") do |file|
  pic = TagLib::FLAC::Picture.new
  pic.type = TagLib::FLAC::Picture::FrontCover
  pic.mime_type = "image/jpeg"
  pic.description = "desc"
  pic.width = 90
  pic.height = 90
  pic.data = File.open("cover.jpg", 'rb') { |f| f.read }

  file.add_picture(pic)
  file.save
end

Since:

  • 0.5.0

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TagLib::File

#close, #save

Constructor Details

#initialize(filename, read_properties = true) ⇒ File

Load a FLAC file.

Parameters:

  • filename (String)
  • read_properties (Boolean) (defaults to: true)

    if audio properties should be read

Since:

  • 0.5.0


46
47
# File 'docs/taglib/flac.rb', line 46

def initialize(filename, read_properties=true)
end

Class Method Details

.open(filename, read_properties = true) {|file| ... } ⇒ Object

Parameters:

  • filename (String)
  • read_properties (Boolean) (defaults to: true)

    if audio properties should be read

Yields:

Returns:

  • the return value of the block

Since:

  • 0.5.0


38
39
# File 'docs/taglib/flac.rb', line 38

def self.open(filename, read_properties=true)
end

Instance Method Details

#add_picture(picture) ⇒ void

This method returns an undefined value.

Add a picture to the file.

Parameters:

Since:

  • 0.5.0


95
96
# File 'docs/taglib/flac.rb', line 95

def add_picture(picture)
end

#audio_propertiesTagLib::FLAC::Properties

Returns audio properties.

Returns:

Since:

  • 0.5.0


76
77
# File 'docs/taglib/flac.rb', line 76

def audio_properties
end

#id3v1_tagTagLib::ID3v1::Tag

Returns the ID3v1 tag.

Returns:

Since:

  • 0.5.0


64
65
# File 'docs/taglib/flac.rb', line 64

def id3v1_tag
end

#id3v2_tagTagLib::ID3v2::Tag

Returns the ID3v2 tag.

Returns:

Since:

  • 0.5.0


70
71
# File 'docs/taglib/flac.rb', line 70

def id3v2_tag
end

#picture_listArray<TagLib::FLAC::Picture>

Returns an array of the pictures attached to the file.

Returns:

Since:

  • 0.5.0


82
83
# File 'docs/taglib/flac.rb', line 82

def picture_list
end

#remove_picturesvoid

This method returns an undefined value.

Remove all pictures.

Since:

  • 0.5.0


88
89
# File 'docs/taglib/flac.rb', line 88

def remove_pictures
end

#tagTagLib::Tag

Returns the union of the Xiph comment, ID3v1 and ID3v2 tag.

Returns:

Since:

  • 0.5.0


52
53
# File 'docs/taglib/flac.rb', line 52

def tag
end

#xiph_commentTagLib::Ogg::XiphComment

Returns the Xiph comment tag.

Returns:

Since:

  • 0.5.0


58
59
# File 'docs/taglib/flac.rb', line 58

def xiph_comment
end