class RemiAudio::VorbisComment
- RemiAudio::VorbisComment
- Reference
- Object
Overview
Stores Ogg Vorbis Comment metadata.
Defined in:
remiaudio/vorbiscomment.crConstructors
-
.new(rawData : Bytes, ignoreMissingFramingBit : Bool = false)
Creates a new set of Vorbis Comments by parsing
rawData. -
.new(io : IO, ignoreMissingFramingBit : Bool = false)
Creates a new set of Vorbis Comments by reading from
io. -
.new
Creates a new, empty set of Vorbis Comments.
Class Method Summary
-
.validKeyName(name : String) : Bool
Returns
trueifnameis a valid string for a Vorbis Comment key, orfalseotherwise.
Instance Method Summary
-
#<<(value : Tuple(String, String))
Adds a new comment to the set.
-
#[](name : String) : Array(String)
Returns the set of comments associated with the given key.
-
#[]=(key : String, value : String)
Adds a new comment to the set.
-
#[]?(name : String) : Array(String) | Nil
Attempts to return the set of comments associated with the given key.
-
#clear
Removes all comments from this set, then returns
self. -
#comments : Array(Tuple(String, String))
Returns an array of
Tuple(String, String)containing all of the comments in this set. -
#delete(key : String, valNum : Int) : String
Removes a specific comment stored under the key name
key. -
#delete(key : String)
Removes all comments stored under the key name
key. -
#each(&)
Loops over all of the comments, yielding each unique comment as a
Tuple(String, String)to the block. -
#eachKey(&)
Loops over all the unique keys, yielding the
Array(String)of comments for each key to the block. -
#empty?
Returns
trueif this set has no comments, orfalseotherwise. -
#numKeys
Returns the number of unique key names stored in this set.
-
#parse(rawData : Bytes, ignoreMissingFramingBit : Bool = false) : Int32
Appends new comments onto this set of Vorbis Comments by parsing
rawData. -
#parse(io : IO, ignoreMissingFramingBit : Bool = false) : Int32
Appends new comments onto this set of Vorbis Comments by parsing
rawData. -
#size : UInt32
Returns the total number of comments stored in this set.
-
#vendor : String
The vendor string for the Vorbis Comments set.
-
#vendor=(vendor : String)
The vendor string for the Vorbis Comments set.
-
#write(io : IO, noFramingBit : Bool = false) : IO
Writes this comment set to
io, then returnsio.
Constructor Detail
Creates a new set of Vorbis Comments by parsing rawData. If
ignoreMissingFramingBit is true, then the parser will not check for
the framing bit at the end of the comments.
Creates a new set of Vorbis Comments by reading from io. If
ignoreMissingFramingBit is true, then the parser will not check for
the framing bit at the end of the comments.
Class Method Detail
Returns true if name is a valid string for a Vorbis Comment key, or
false otherwise.
Instance Method Detail
Adds a new comment to the set. The 0th value of the Tuple is the key
name. If the key is not a valid key name, this will raise a
VorbisComment::Error. This returns self.
The key name will always be converted to upper case.
Returns the set of comments associated with the given key. If the key
does not exist, this raises a KeyError is raised.
The case of name does not matter. It cannot be blank.
Note: modifications to the returned array will change the data stored in
this VorbisComment instance.
Adds a new comment to the set. If the key is not a valid key name, this
will raise a VorbisComment::Error. This returns self.
key will always be converted to upper case.
Attempts to return the set of comments associated with the given key. If
the key does not exist, this returns nil.
The case of name does not matter.
Note: modifications to the returned array will change the data stored in
this VorbisComment instance.
Returns an array of Tuple(String, String) containing all of the comments
in this set. The returned array can be safely modified without affecting
the underlying data in this VorbisComment instance.
Removes a specific comment stored under the key name key. If the key
does not exist, this raises a KeyError. This returns the deleted
comment value.
The case of key does not matter.
Removes all comments stored under the key name key. If the key does not
exist, this does nothing. This returns self.
The case of key does not matter.
Loops over all of the comments, yielding each unique comment as a
Tuple(String, String) to the block.
Loops over all the unique keys, yielding the Array(String) of comments
for each key to the block.
Note: modifications to the yielded array will change the data stored in
this VorbisComment instance.
Appends new comments onto this set of Vorbis Comments by parsing
rawData. If ignoreMissingFramingBit is true, then the parser will
not check for the framing bit at the end of the comments. This returns
the number of comments added to the set.
Appends new comments onto this set of Vorbis Comments by parsing
rawData. If ignoreMissingFramingBit is true, then the parser will
not check for the framing bit at the end of the comments. This returns
the number of comments added to the set.
Writes this comment set to io, then returns io. If noFramingBit is
true, then this will not write the framing bit at the end.