taglib-ruby 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +9 -0
- data/CHANGES.md +22 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +13 -3
- data/Guardfile +8 -0
- data/README.md +48 -36
- data/Rakefile +5 -7
- data/docs/default/fulldoc/html/css/common.css +1 -0
- data/docs/taglib/base.rb +130 -0
- data/docs/taglib/id3v2.rb +383 -0
- data/docs/taglib/mpeg.rb +95 -0
- data/ext/taglib_base/includes.i +35 -3
- data/ext/taglib_base/taglib_base.i +19 -13
- data/ext/taglib_base/taglib_base_wrap.cxx +1440 -3357
- data/ext/taglib_id3v2/relativevolumeframe.i +35 -0
- data/ext/taglib_id3v2/taglib_id3v2.i +54 -52
- data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +3508 -10952
- data/ext/taglib_mpeg/taglib_mpeg.i +8 -7
- data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +703 -1569
- data/lib/taglib.rb +1 -0
- data/lib/taglib/id3v2.rb +8 -30
- data/lib/taglib/version.rb +2 -2
- data/taglib-ruby.gemspec +26 -5
- data/tasks/docs_coverage.rake +26 -0
- data/test/data/add-relative-volume.cpp +40 -0
- data/test/data/crash.mp3 +0 -0
- data/test/data/relative-volume.mp3 +0 -0
- data/test/test_fileref_properties.rb +21 -0
- data/test/test_id3v2_frames.rb +25 -8
- data/test/test_id3v2_relative_volume.rb +57 -0
- data/test/test_id3v2_tag.rb +23 -0
- data/test/test_mpeg_file.rb +49 -0
- metadata +55 -10
data/.yardopts
ADDED
data/CHANGES.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Changes in Releases of taglib-ruby
|
2
|
+
==================================
|
3
|
+
|
4
|
+
## 0.2.0 (2011-10-22)
|
5
|
+
|
6
|
+
* API documentation
|
7
|
+
* Add support for:
|
8
|
+
* TagLib::AudioProperties and TagLib::MPEG::Properties (#4)
|
9
|
+
* TagLib::ID3v2::RelativeVolumeFrame
|
10
|
+
|
11
|
+
## 0.1.1 (2011-09-17)
|
12
|
+
|
13
|
+
* Add installation instructions and clean up description
|
14
|
+
|
15
|
+
## 0.1.0 (2011-09-17)
|
16
|
+
|
17
|
+
* Initial release
|
18
|
+
* Coverage of the following API:
|
19
|
+
* TagLib::FileRef
|
20
|
+
* TagLib::MPEG::File
|
21
|
+
* TagLib::ID3v2::Tag
|
22
|
+
* TagLib::ID3v2::Frame and subclasses
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,11 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
git (1.2.5)
|
5
|
+
guard (0.8.4)
|
6
|
+
thor (~> 0.14.6)
|
7
|
+
guard-test (0.4.0)
|
8
|
+
guard (>= 0.4)
|
9
|
+
test-unit (~> 2.2)
|
5
10
|
jeweler (1.6.4)
|
6
11
|
bundler (~> 1.0)
|
7
12
|
git (>= 1.2.5)
|
@@ -9,17 +14,22 @@ GEM
|
|
9
14
|
rake (0.9.2)
|
10
15
|
rake-compiler (0.7.9)
|
11
16
|
rake
|
12
|
-
rcov (0.9.
|
13
|
-
|
17
|
+
rcov (0.9.11)
|
18
|
+
redcarpet (1.17.2)
|
14
19
|
shoulda (2.11.3)
|
20
|
+
test-unit (2.4.0)
|
21
|
+
thor (0.14.6)
|
22
|
+
yard (0.7.3)
|
15
23
|
|
16
24
|
PLATFORMS
|
17
25
|
ruby
|
18
26
|
|
19
27
|
DEPENDENCIES
|
20
28
|
bundler (~> 1.0.0)
|
29
|
+
guard-test (~> 0.4.0)
|
21
30
|
jeweler (~> 1.6.4)
|
22
31
|
rake-compiler (~> 0.7)
|
23
32
|
rcov
|
24
|
-
|
33
|
+
redcarpet
|
25
34
|
shoulda (~> 2.11)
|
35
|
+
yard (~> 0.7)
|
data/Guardfile
ADDED
data/README.md
CHANGED
@@ -10,7 +10,6 @@ accessed.
|
|
10
10
|
taglib-ruby is work in progress, here are some of the things still left
|
11
11
|
to do (contributors very welcome):
|
12
12
|
|
13
|
-
* Wrap TagLib::MPEG::Properties
|
14
13
|
* Pre-compiled Gem for Windows
|
15
14
|
* More coverage of the library besides ID3v2
|
16
15
|
|
@@ -34,48 +33,52 @@ Usage
|
|
34
33
|
|
35
34
|
Here's an example for reading an ID3v2 tag:
|
36
35
|
|
37
|
-
|
36
|
+
```ruby
|
37
|
+
require 'taglib'
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
# Load an ID3v2 tag from a file
|
40
|
+
file = TagLib::MPEG::File.new("wake_up.mp3")
|
41
|
+
tag = file.id3v2_tag
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
# Read basic attributes
|
44
|
+
tag.title #=> "Wake Up"
|
45
|
+
tag.artist #=> "Arcade Fire"
|
46
|
+
tag.track #=> 7
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
# Access all frames
|
49
|
+
tag.frame_list.size #=> 13
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
# Track frame
|
52
|
+
track = tag.frame_list('TRCK').first
|
53
|
+
track.to_s #=> "7/10"
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
# Attached picture frame
|
56
|
+
cover = tag.frame_list('APIC').first
|
57
|
+
cover.mime_type #=> "image/jpeg"
|
58
|
+
cover.picture #=> "\xFF\xD8\xFF\xE0\x00\x10JFIF..."
|
59
|
+
```
|
59
60
|
|
60
61
|
And here's an example for writing one:
|
61
62
|
|
62
|
-
|
63
|
-
|
63
|
+
```ruby
|
64
|
+
file = TagLib::MPEG::File.new("joga.mp3")
|
65
|
+
tag = file.id3v2_tag
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
# Write basic attributes
|
68
|
+
tag.artist = "Björk"
|
69
|
+
tag.title = "Jóga"
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
# Add attached picture frame
|
72
|
+
apic = TagLib::ID3v2::AttachedPictureFrame.new
|
73
|
+
apic.mime_type = "image/jpeg"
|
74
|
+
apic.description = "Cover"
|
75
|
+
apic.type = TagLib::ID3v2::AttachedPictureFrame::FrontCover
|
76
|
+
apic.picture = File.open("cover.jpg", 'rb'){ |f| f.read }
|
75
77
|
|
76
|
-
|
78
|
+
tag.add_frame(apic)
|
77
79
|
|
78
|
-
|
80
|
+
file.save
|
81
|
+
```
|
79
82
|
|
80
83
|
### Encoding
|
81
84
|
|
@@ -87,14 +90,23 @@ stores the text as UTF-8.
|
|
87
90
|
When you already know that you want to store the text as UTF-8, you can
|
88
91
|
change the default text encoding:
|
89
92
|
|
90
|
-
|
91
|
-
|
93
|
+
```ruby
|
94
|
+
frame_factory = TagLib::ID3v2::FrameFactory.instance
|
95
|
+
frame_factory.default_text_encoding = TagLib::String::UTF8
|
96
|
+
```
|
92
97
|
|
93
98
|
Another option is using the advanced API:
|
94
99
|
|
95
|
-
|
96
|
-
|
97
|
-
|
100
|
+
```ruby
|
101
|
+
title = tag.frame_list('TIT2').first
|
102
|
+
title.text = "Jóga"
|
103
|
+
title.text_encoding = TagLib::String::UTF8
|
104
|
+
```
|
105
|
+
|
106
|
+
Release Notes
|
107
|
+
-------------
|
108
|
+
|
109
|
+
See {file:CHANGES.md}.
|
98
110
|
|
99
111
|
Contributing
|
100
112
|
------------
|
data/Rakefile
CHANGED
@@ -58,12 +58,10 @@ end
|
|
58
58
|
|
59
59
|
task :default => :test
|
60
60
|
|
61
|
-
require '
|
62
|
-
Rake::
|
61
|
+
require 'yard'
|
62
|
+
YARD::Rake::YardocTask.new do |t|
|
63
63
|
version = TagLib::Version::STRING
|
64
|
-
|
65
|
-
rdoc.rdoc_dir = 'rdoc'
|
66
|
-
rdoc.title = "taglib-ruby #{version}"
|
67
|
-
rdoc.rdoc_files.include('README*')
|
68
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
64
|
+
t.options = ['--title', "taglib-ruby #{version}"]
|
69
65
|
end
|
66
|
+
|
67
|
+
FileList['tasks/**/*.rake'].each { |task| import task }
|
@@ -0,0 +1 @@
|
|
1
|
+
.showSource { display: none; }
|
data/docs/taglib/base.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
# This is the top-level module of taglib-ruby.
|
2
|
+
#
|
3
|
+
# Where to find what:
|
4
|
+
#
|
5
|
+
# * Reading/writing basic tag and audio properties without having to
|
6
|
+
# know the tagging format: {TagLib::FileRef}
|
7
|
+
# * Reading properties of MPEG files: {TagLib::MPEG::File}
|
8
|
+
# * Reading/writing ID3v2 tags: {TagLib::MPEG::File} and
|
9
|
+
# {TagLib::MPEG::File#id3v2_tag}
|
10
|
+
#
|
11
|
+
# ## String Encodings
|
12
|
+
#
|
13
|
+
# Sometimes, it is necessary to specify which encoding should be used to
|
14
|
+
# store strings in tags. For this, the following constants are defined:
|
15
|
+
#
|
16
|
+
# * `TagLib::String::Latin1`
|
17
|
+
# * `TagLib::String::UTF16`
|
18
|
+
# * `TagLib::String::UTF16BE`
|
19
|
+
# * `TagLib::String::UTF8`
|
20
|
+
# * `TagLib::String::UTF16LE`
|
21
|
+
#
|
22
|
+
# For ID3v2 frames, you can also set a default text encoding globally
|
23
|
+
# using the {TagLib::ID3v2::FrameFactory}.
|
24
|
+
module TagLib
|
25
|
+
|
26
|
+
# This class allows to read basic tagging and audio properties from
|
27
|
+
# files, without having to know what the file type is. Thus, it works
|
28
|
+
# for all tagging formats that taglib supports, but only provides a
|
29
|
+
# minimal API.
|
30
|
+
#
|
31
|
+
# Should you need more, use the file type specific classes, see
|
32
|
+
# subclasses of {TagLib::File}.
|
33
|
+
class FileRef
|
34
|
+
# Create a FileRef from a file name.
|
35
|
+
#
|
36
|
+
# @param [String] filename
|
37
|
+
# @param [Boolean] read_audio_properties
|
38
|
+
# true if audio properties should be read
|
39
|
+
# @param [TagLib::AudioProperties constants] audio_properties_style
|
40
|
+
# how accurately the audio properties should be read, e.g.
|
41
|
+
# {TagLib::AudioProperties::Average}
|
42
|
+
def initialize(filename, read_audio_properties=true,
|
43
|
+
audio_properties_style=TagLib::AudioProperties::Average)
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [TagLib::AudioProperties] the audio properties
|
47
|
+
def audio_properties
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [Boolean] if the file is null (i.e. it could not be read)
|
51
|
+
def null?
|
52
|
+
end
|
53
|
+
|
54
|
+
# Saves the file
|
55
|
+
#
|
56
|
+
# @return [Boolean] whether saving was successful
|
57
|
+
def save
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [TagLib::Tag] the tag
|
61
|
+
def tag
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# @abstract Base class for files, see subclasses.
|
66
|
+
class File
|
67
|
+
end
|
68
|
+
|
69
|
+
# @abstract Base class for tags.
|
70
|
+
#
|
71
|
+
# This is a unified view which provides basic tag information, which
|
72
|
+
# is common in all tag formats. See subclasses for functionality that
|
73
|
+
# goes beyond this interface.
|
74
|
+
class Tag
|
75
|
+
# @return [String] the album
|
76
|
+
# @return [nil] if not present
|
77
|
+
attr_accessor :album
|
78
|
+
|
79
|
+
# @return [String] the artist/interpret
|
80
|
+
# @return [nil] if not present
|
81
|
+
attr_accessor :artist
|
82
|
+
|
83
|
+
# @return [String] the comment
|
84
|
+
# @return [nil] if not present
|
85
|
+
attr_accessor :comment
|
86
|
+
|
87
|
+
# @return [String] the genre
|
88
|
+
# @return [nil] if not present
|
89
|
+
attr_accessor :genre
|
90
|
+
|
91
|
+
# @return [String] the title
|
92
|
+
# @return [nil] if not present
|
93
|
+
attr_accessor :title
|
94
|
+
|
95
|
+
# @return [Integer] the track number
|
96
|
+
# @return [0] if not present
|
97
|
+
attr_accessor :track
|
98
|
+
|
99
|
+
# @return [Integer] the year
|
100
|
+
# @return [0] if not present
|
101
|
+
attr_accessor :year
|
102
|
+
|
103
|
+
# @return [Boolean]
|
104
|
+
def empty?; end
|
105
|
+
end
|
106
|
+
|
107
|
+
# @abstract Base class for audio properties.
|
108
|
+
class AudioProperties
|
109
|
+
|
110
|
+
Fast = 0
|
111
|
+
Average = 1
|
112
|
+
Accurate = 2
|
113
|
+
|
114
|
+
# @return [Integer] length of the file in seconds
|
115
|
+
def length
|
116
|
+
end
|
117
|
+
|
118
|
+
# @return [Integer] bit rate in kb/s (kilobit per second)
|
119
|
+
def bitrate
|
120
|
+
end
|
121
|
+
|
122
|
+
# @return [Integer] sample rate in Hz
|
123
|
+
def sample_rate
|
124
|
+
end
|
125
|
+
|
126
|
+
# @return [Integer] number of channels
|
127
|
+
def channels
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,383 @@
|
|
1
|
+
module TagLib::ID3v2
|
2
|
+
# An ID3v2 tag.
|
3
|
+
class Tag < TagLib::Tag
|
4
|
+
# Get a list of frames. Note that the frames returned are subclasses
|
5
|
+
# of {TagLib::ID3v2::Frame}, depending on the frame ID.
|
6
|
+
#
|
7
|
+
# @overload frame_list()
|
8
|
+
# Returns all frames.
|
9
|
+
#
|
10
|
+
# @overload frame_list(frame_id)
|
11
|
+
# Returns frames matching ID.
|
12
|
+
#
|
13
|
+
# @param [String] frame_id Specify this parameter to get only the
|
14
|
+
# frames matching a frame ID (e.g. "TIT2").
|
15
|
+
#
|
16
|
+
# @return [Array<TagLib::ID3v2::Frame>]
|
17
|
+
def frame_list
|
18
|
+
end
|
19
|
+
|
20
|
+
# Add a frame to the tag.
|
21
|
+
#
|
22
|
+
# @param [Frame] frame
|
23
|
+
# @return [void]
|
24
|
+
def add_frame(frame)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Remove the passed frame from the tag.
|
28
|
+
#
|
29
|
+
# **Note:** You can and shall not call any methods on the frame
|
30
|
+
# object after you have passed it to this method, because the
|
31
|
+
# underlying C++ object has been deleted.
|
32
|
+
#
|
33
|
+
# @param [Frame] frame to remove
|
34
|
+
# @return [void]
|
35
|
+
def remove_frame(frame)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Remove all frames with the specified ID from the tag.
|
39
|
+
#
|
40
|
+
# **Note:** If you have obtained any frame objects with the same ID
|
41
|
+
# from the tag before calling this method, you should not touch them
|
42
|
+
# anymore. The reason is that the C++ objects may have been deleted.
|
43
|
+
#
|
44
|
+
# @param [String] id
|
45
|
+
# @return [void]
|
46
|
+
def remove_frames(id)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Frame factory for ID3v2 frames. Useful for setting the default text
|
51
|
+
# encoding.
|
52
|
+
class FrameFactory
|
53
|
+
# @return [FrameFactory] the default frame factory
|
54
|
+
def self.instance
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get/set the default text encoding for new ID3v2 frames. See the
|
58
|
+
# section _String Encodings_ in {TagLib}.
|
59
|
+
#
|
60
|
+
# @return [TagLib::String constant] default text encoding
|
61
|
+
attr_accessor :default_text_encoding
|
62
|
+
end
|
63
|
+
|
64
|
+
# The base class for all ID3v2 frames.
|
65
|
+
#
|
66
|
+
# In ID3v2 all frames are identified by a {#frame_id frame ID}, such
|
67
|
+
# as `TIT2` or `APIC`. The data in the frames is different depending
|
68
|
+
# on the frame type, which is why there is a subclass for each type.
|
69
|
+
#
|
70
|
+
# The most common frame type is the text identification frame. All
|
71
|
+
# frame IDs of this type begin with `T`, for example `TALB` for the
|
72
|
+
# album. See {TextIdentificationFrame}.
|
73
|
+
#
|
74
|
+
# Then there are the URL link frames, which begin with `W`, see
|
75
|
+
# {UrlLinkFrame}.
|
76
|
+
#
|
77
|
+
# Finally, there are some specialized frame types and their
|
78
|
+
# corresponding classes:
|
79
|
+
#
|
80
|
+
# * `APIC`: {AttachedPictureFrame}
|
81
|
+
# * `COMM`: {CommentsFrame}
|
82
|
+
# * `GEOB`: {GeneralEncapsulatedObjectFrame}
|
83
|
+
# * `POPM`: {PopularimeterFrame}
|
84
|
+
# * `PRIV`: {PrivateFrame}
|
85
|
+
# * `RVAD`: {RelativeVolumeFrame}
|
86
|
+
# * `TXXX`: {UserTextIdentificationFrame}
|
87
|
+
# * `UFID`: {UniqueFileIdentifierFrame}
|
88
|
+
# * `USLT`: {UnsynchronizedLyricsFrame}
|
89
|
+
# * `WXXX`: {UserUrlLinkFrame}
|
90
|
+
#
|
91
|
+
class Frame
|
92
|
+
# @return [String] frame ID
|
93
|
+
attr_reader :frame_id
|
94
|
+
|
95
|
+
# @return [String] a subclass-specific string representation
|
96
|
+
def to_string
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Attached picture frame (`APIC`), e.g. for cover art.
|
101
|
+
#
|
102
|
+
# The constants in this class are used for the {#type} attribute.
|
103
|
+
class AttachedPictureFrame < Frame
|
104
|
+
# Other
|
105
|
+
Other = 0x00
|
106
|
+
# 32x32 file icon (PNG only)
|
107
|
+
FileIcon = 0x01
|
108
|
+
OtherFileIcon = 0x02
|
109
|
+
FrontCover = 0x03
|
110
|
+
BackCover = 0x04
|
111
|
+
LeafletPage = 0x05
|
112
|
+
Media = 0x06
|
113
|
+
LeadArtist = 0x07
|
114
|
+
Artist = 0x08
|
115
|
+
Conductor = 0x09
|
116
|
+
Band = 0x0A
|
117
|
+
Composer = 0x0B
|
118
|
+
Lyricist = 0x0C
|
119
|
+
RecordingLocation = 0x0D
|
120
|
+
DuringRecording = 0x0E
|
121
|
+
DuringPerformance = 0x0F
|
122
|
+
MovieScreenCapture = 0x10
|
123
|
+
ColouredFish = 0x11
|
124
|
+
Illustration = 0x12
|
125
|
+
BandLogo = 0x13
|
126
|
+
PublisherLogo = 0x14
|
127
|
+
|
128
|
+
def initialize()
|
129
|
+
end
|
130
|
+
|
131
|
+
# @return [String]
|
132
|
+
attr_accessor :description
|
133
|
+
|
134
|
+
# MIME type (e.g. `"image/png"`)
|
135
|
+
# @return [String]
|
136
|
+
attr_accessor :mime_type
|
137
|
+
|
138
|
+
# {include:GeneralEncapsulatedObjectFrame#object}
|
139
|
+
#
|
140
|
+
# @return [binary String]
|
141
|
+
attr_accessor :picture
|
142
|
+
|
143
|
+
# {include:TextIdentificationFrame#text_encoding}
|
144
|
+
#
|
145
|
+
# @return [TagLib::String constant]
|
146
|
+
attr_accessor :text_encoding
|
147
|
+
|
148
|
+
# Type of the attached picture, see constants.
|
149
|
+
# @return [AttachedPictureFrame constant]
|
150
|
+
attr_accessor :type
|
151
|
+
end
|
152
|
+
|
153
|
+
# Comments frame (`COMM`) for full text information that doesn't fit in
|
154
|
+
# any other frame.
|
155
|
+
class CommentsFrame < Frame
|
156
|
+
# @return [String] content description, which together with language
|
157
|
+
# should be unique per tag
|
158
|
+
attr_accessor :description
|
159
|
+
|
160
|
+
# @return [String] alpha-3 language code of text (ISO-639-2),
|
161
|
+
# e.g. "eng"
|
162
|
+
attr_accessor :language
|
163
|
+
|
164
|
+
# @return [String] the actual comment text
|
165
|
+
attr_accessor :text
|
166
|
+
|
167
|
+
# {include:TextIdentificationFrame#text_encoding}
|
168
|
+
#
|
169
|
+
# @return [TagLib::String constant]
|
170
|
+
attr_accessor :text_encoding
|
171
|
+
end
|
172
|
+
|
173
|
+
# General encapsulated object frame (`GEOB`).
|
174
|
+
class GeneralEncapsulatedObjectFrame < Frame
|
175
|
+
# @return [String] content description
|
176
|
+
attr_accessor :description
|
177
|
+
|
178
|
+
# @return [String] file name
|
179
|
+
attr_accessor :file_name
|
180
|
+
|
181
|
+
# @return [String] MIME type
|
182
|
+
attr_accessor :mime_type
|
183
|
+
|
184
|
+
# Binary data string.
|
185
|
+
#
|
186
|
+
# Be sure to use a binary string when setting this attribute. In
|
187
|
+
# Ruby 1.9, this means reading from a file with `"b"` mode to get a
|
188
|
+
# string with encoding `BINARY` / `ASCII-8BIT`.
|
189
|
+
#
|
190
|
+
# @return [binary String]
|
191
|
+
attr_accessor :object
|
192
|
+
|
193
|
+
# {include:TextIdentificationFrame#text_encoding}
|
194
|
+
#
|
195
|
+
# @return [String]
|
196
|
+
attr_accessor :text_encoding
|
197
|
+
end
|
198
|
+
|
199
|
+
# Popularimeter frame (`POPM`).
|
200
|
+
class PopularimeterFrame < Frame
|
201
|
+
# @return [Integer] play counter
|
202
|
+
attr_accessor :counter
|
203
|
+
|
204
|
+
# @return [String] e-mail address
|
205
|
+
attr_accessor :email
|
206
|
+
|
207
|
+
# @return [Integer] rating
|
208
|
+
attr_accessor :rating
|
209
|
+
end
|
210
|
+
|
211
|
+
# Private frame (`PRIV`).
|
212
|
+
class PrivateFrame < Frame
|
213
|
+
# {include:GeneralEncapsulatedObjectFrame#object}
|
214
|
+
#
|
215
|
+
# @return [binary String]
|
216
|
+
attr_accessor :data
|
217
|
+
|
218
|
+
# @return [String] owner identifier
|
219
|
+
attr_accessor :owner
|
220
|
+
end
|
221
|
+
|
222
|
+
# Relative volume adjustment frame (`RVAD` or `RVA2`).
|
223
|
+
class RelativeVolumeFrame < Frame
|
224
|
+
Other = 0x00
|
225
|
+
MasterVolume = 0x01
|
226
|
+
FrontRight = 0x02
|
227
|
+
FrontLeft = 0x03
|
228
|
+
BackRight = 0x04
|
229
|
+
BackLeft = 0x05
|
230
|
+
FrontCentre = 0x06
|
231
|
+
BackCentre = 0x07
|
232
|
+
Subwoofer = 0x08
|
233
|
+
|
234
|
+
# @return [Array<TagLib::ID3v2::RelativeVolumeFrame constant>]
|
235
|
+
# the channel types for which volume adjustment information is
|
236
|
+
# stored in this frame
|
237
|
+
def channels
|
238
|
+
end
|
239
|
+
|
240
|
+
# @return [String] relative volume identification
|
241
|
+
attr_accessor :identification
|
242
|
+
|
243
|
+
# Returns peak volume for channel type.
|
244
|
+
#
|
245
|
+
# @param [TagLib::ID3v2::RelativeVolumeFrame constant] type
|
246
|
+
# @return [TagLib::ID3v2::PeakVolume]
|
247
|
+
def peak_volume(type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
|
248
|
+
end
|
249
|
+
|
250
|
+
# Sets peak volume for channel type.
|
251
|
+
#
|
252
|
+
# @param [TagLib::ID3v2::PeakVolume] peak peak volume
|
253
|
+
# @param [TagLib::ID3v2::RelativeVolumeFrame constant] type
|
254
|
+
# @return [void]
|
255
|
+
def set_peak_volume(peak, type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
|
256
|
+
end
|
257
|
+
|
258
|
+
# Returns volume adjustment in decibels for a specific channel type.
|
259
|
+
# Internally, this is stored as an index, see
|
260
|
+
# {#volume_adjustment_index}.
|
261
|
+
#
|
262
|
+
# @param [TagLib::ID3v2::RelativeVolumeFrame constant] type
|
263
|
+
# @return [Float]
|
264
|
+
def volume_adjustment(type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
|
265
|
+
end
|
266
|
+
|
267
|
+
# Sets volume adjustment in decibels for a specific channel type.
|
268
|
+
# Internally, this is stored as an index, see
|
269
|
+
# {#set_volume_adjustment_index}.
|
270
|
+
#
|
271
|
+
# @param [Float] adjustment
|
272
|
+
# @param [TagLib::ID3v2::RelativeVolumeFrame constant] type
|
273
|
+
# @return [void]
|
274
|
+
def set_volume_adjustment(adjustment, type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns volume adjustment index for a specific channel type. When
|
278
|
+
# dividing the index by 512, it corresponds to the volume adjustment
|
279
|
+
# in decibel.
|
280
|
+
#
|
281
|
+
# @param [TagLib::ID3v2::RelativeVolumeFrame constant] type
|
282
|
+
# @return [Integer]
|
283
|
+
def volume_adjustment_index(type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Sets volume adjustment index for a specific channel type. When
|
287
|
+
# dividing the index by 512, it corresponds to the volume adjustment
|
288
|
+
# in decibel.
|
289
|
+
#
|
290
|
+
# @param [Integer] index
|
291
|
+
# @param [TagLib::ID3v2::RelativeVolumeFrame constant] type
|
292
|
+
# @return [void]
|
293
|
+
def set_volume_adjustment_index(index, type=TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
# Peak volume used for {RelativeVolumeFrame}. The two attributes of
|
298
|
+
# this class must always read/written together, as they are used to
|
299
|
+
# describe one concept, the peak volume number.
|
300
|
+
#
|
301
|
+
# Note that due to how SWIG works, this is not a nested class of
|
302
|
+
# RelativeVolumeFrame as in taglib. That doesn't affect its usage
|
303
|
+
# though.
|
304
|
+
class PeakVolume
|
305
|
+
# @return [Integer] the number of bits of the {#peak_volume} that
|
306
|
+
# represent the peak volume (0 to 255)
|
307
|
+
attr_accessor :bits_representing_peak
|
308
|
+
|
309
|
+
# @return [binary String] the (byte-padded) bits used for the peak
|
310
|
+
# volume
|
311
|
+
attr_accessor :peak_volume
|
312
|
+
end
|
313
|
+
|
314
|
+
# Text identification frame (`T???`).
|
315
|
+
class TextIdentificationFrame < Frame
|
316
|
+
# Encoding for storing the text in the tag, e.g.
|
317
|
+
# `TagLib::String::UTF8`. See the section _String Encodings_ in
|
318
|
+
# {TagLib}.
|
319
|
+
#
|
320
|
+
# @return [TagLib::String constant]
|
321
|
+
attr_accessor :text_encoding
|
322
|
+
|
323
|
+
# @return [Array<String>] list of text strings in this frame
|
324
|
+
attr_accessor :field_list
|
325
|
+
|
326
|
+
# @param [String] text simple text to set
|
327
|
+
attr_writer :text
|
328
|
+
end
|
329
|
+
|
330
|
+
# User text identification frame (`TXXX`).
|
331
|
+
class UserTextIdentificationFrame < TextIdentificationFrame
|
332
|
+
# @return [String] description of content
|
333
|
+
attr_accessor :description
|
334
|
+
end
|
335
|
+
|
336
|
+
# Unique file identifier frame (`UFID`).
|
337
|
+
class UniqueFileIdentifierFrame < Frame
|
338
|
+
# @return [String] identifier
|
339
|
+
attr_accessor :identifier
|
340
|
+
|
341
|
+
# @return [String] owner
|
342
|
+
attr_accessor :owner
|
343
|
+
end
|
344
|
+
|
345
|
+
# Unsynchronized lyrics frame (`USLT`).
|
346
|
+
class UnsynchronizedLyricsFrame < Frame
|
347
|
+
# @return [String] frame description
|
348
|
+
attr_accessor :description
|
349
|
+
|
350
|
+
# @return [String] alpha-3 language code of text (ISO-639-2),
|
351
|
+
# e.g. "eng"
|
352
|
+
attr_accessor :language
|
353
|
+
|
354
|
+
# @return [String] text
|
355
|
+
attr_accessor :text
|
356
|
+
|
357
|
+
# {include:TextIdentificationFrame#text_encoding}
|
358
|
+
#
|
359
|
+
# @return [String]
|
360
|
+
attr_accessor :text_encoding
|
361
|
+
end
|
362
|
+
|
363
|
+
# URL link frame (`W???`), e.g. `WOAR` for "official artist/performer
|
364
|
+
# webpage".
|
365
|
+
class UrlLinkFrame < Frame
|
366
|
+
# @param [String] text simple text to set
|
367
|
+
attr_writer :text
|
368
|
+
|
369
|
+
# @param [String] URL
|
370
|
+
attr_accessor :url
|
371
|
+
end
|
372
|
+
|
373
|
+
# User URL link frame (`WXXX`).
|
374
|
+
class UserUrlLinkFrame < UrlLinkFrame
|
375
|
+
# @return [String] description
|
376
|
+
attr_accessor :description
|
377
|
+
|
378
|
+
# {include:TextIdentificationFrame#text_encoding}
|
379
|
+
#
|
380
|
+
# @return [String]
|
381
|
+
attr_accessor :text_encoding
|
382
|
+
end
|
383
|
+
end
|