Class: TagLib::FileRef
- Inherits:
-
Object
- Object
- TagLib::FileRef
- Defined in:
- docs/taglib/base.rb
Overview
This class allows to read basic tagging and audio properties from files, without having to know what the file type is. Thus, it works for all tagging formats that taglib supports, but only provides a minimal API.
Should you need more, use the file type specific classes, see subclasses of File.
Class Method Summary collapse
-
.open(filename, read_audio_properties = true, audio_properties_style = TagLib::AudioProperties::Average) {|file| ... } ⇒ Object
Creates a new file and passes it to the provided block, closing the file automatically at the end of the block.
Instance Method Summary collapse
-
#audio_properties ⇒ TagLib::AudioProperties
Gets the audio properties.
-
#close ⇒ void
Closes the file and releases all objects that were read from the file.
-
#initialize(filename, read_audio_properties = true, audio_properties_style = TagLib::AudioProperties::Average) ⇒ FileRef
constructor
Create a FileRef from a file name.
-
#null? ⇒ Boolean
If the file is null (i.e. it could not be read).
-
#save ⇒ Boolean
Saves the file.
-
#tag ⇒ TagLib::Tag
Gets the tag.
Constructor Details
#initialize(filename, read_audio_properties = true, audio_properties_style = TagLib::AudioProperties::Average) ⇒ FileRef
Create a FileRef from a file name.
123 124 125 |
# File 'docs/taglib/base.rb', line 123 def initialize(filename, read_audio_properties=true, audio_properties_style=TagLib::AudioProperties::Average) end |
Class Method Details
.open(filename, read_audio_properties = true, audio_properties_style = TagLib::AudioProperties::Average) {|file| ... } ⇒ Object
Creates a new file and passes it to the provided block, closing the file automatically at the end of the block.
Note that after the block is done, the file is closed and
all memory is released for objects read from the file
(basically everything from the TagLib
namespace).
Using open
is preferable to using new
and then
manually close
.
111 112 113 |
# File 'docs/taglib/base.rb', line 111 def self.open(filename, read_audio_properties=true, audio_properties_style=TagLib::AudioProperties::Average) end |
Instance Method Details
#audio_properties ⇒ TagLib::AudioProperties
Gets the audio properties. Before accessing it, check if there were problems reading the file using #null?. If the audio properties are accessed anyway, a warning will be printed and it will return nil.
133 134 |
# File 'docs/taglib/base.rb', line 133 def audio_properties end |
#close ⇒ void
This method returns an undefined value.
Closes the file and releases all objects that were read from the file.
160 161 |
# File 'docs/taglib/base.rb', line 160 def close end |
#null? ⇒ Boolean
Returns if the file is null (i.e. it could not be read).
137 138 |
# File 'docs/taglib/base.rb', line 137 def null? end |
#save ⇒ Boolean
Saves the file
143 144 |
# File 'docs/taglib/base.rb', line 143 def save end |
#tag ⇒ TagLib::Tag
Gets the tag. Before accessing it, check if there were problems reading the file using #null?. If the tag is accessed anyway, a warning will be printed and it will return nil.
151 152 |
# File 'docs/taglib/base.rb', line 151 def tag end |