Class: ID3Tag::AudioFile
- Inherits:
-
Object
- Object
- ID3Tag::AudioFile
- Defined in:
- lib/id3tag/audio_file.rb
Constant Summary collapse
- ID3V1_TAG_SIZE =
128
- ID3V2_TAG_HEADER_SIZE =
10
- IDV1_TAG_IDENTIFIER =
"TAG"
- IDV2_TAG_IDENTIFIER =
"ID3"
Instance Method Summary collapse
-
#initialize(file) ⇒ AudioFile
constructor
A new instance of AudioFile.
- #v1_tag_body ⇒ Object
- #v1_tag_present? ⇒ Boolean
- #v2_tag_body ⇒ Object
- #v2_tag_major_version_number ⇒ Object
- #v2_tag_minor_version_number ⇒ Object
- #v2_tag_present? ⇒ Boolean
- #v2_tag_version ⇒ Object
Constructor Details
#initialize(file) ⇒ AudioFile
Returns a new instance of AudioFile.
8 9 10 |
# File 'lib/id3tag/audio_file.rb', line 8 def initialize(file) @file = file end |
Instance Method Details
#v1_tag_body ⇒ Object
22 23 24 25 |
# File 'lib/id3tag/audio_file.rb', line 22 def v1_tag_body @file.seek(-ID3V1_TAG_SIZE + IDV1_TAG_IDENTIFIER.size, IO::SEEK_END) @file.read end |
#v1_tag_present? ⇒ Boolean
12 13 14 15 |
# File 'lib/id3tag/audio_file.rb', line 12 def v1_tag_present? @file.seek(-ID3V1_TAG_SIZE, IO::SEEK_END) @file.read(3) == IDV1_TAG_IDENTIFIER end |
#v2_tag_body ⇒ Object
27 28 29 30 |
# File 'lib/id3tag/audio_file.rb', line 27 def v2_tag_body @file.seek(v2_tag_frame_and_padding_position) @file.read(v2_tag_frame_and_padding_size) end |
#v2_tag_major_version_number ⇒ Object
36 37 38 |
# File 'lib/id3tag/audio_file.rb', line 36 def v2_tag_major_version_number v2_tag_header.major_version_number end |
#v2_tag_minor_version_number ⇒ Object
40 41 42 |
# File 'lib/id3tag/audio_file.rb', line 40 def v2_tag_minor_version_number v2_tag_header.minor_version_number end |
#v2_tag_present? ⇒ Boolean
17 18 19 20 |
# File 'lib/id3tag/audio_file.rb', line 17 def v2_tag_present? @file.rewind @file.read(3) == IDV2_TAG_IDENTIFIER end |
#v2_tag_version ⇒ Object
32 33 34 |
# File 'lib/id3tag/audio_file.rb', line 32 def v2_tag_version v2_tag_header.version_number end |