class RemiAudio::VorbisComment

Overview

Stores Ogg Vorbis Comment metadata.

Defined in:

remiaudio/vorbiscomment.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(rawData : Bytes, ignoreMissingFramingBit : Bool = false) #

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.


[View source]
def self.new(io : IO, ignoreMissingFramingBit : Bool = false) #

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.


[View source]
def self.new #

Creates a new, empty set of Vorbis Comments.


[View source]

Class Method Detail

def self.validKeyName(name : String) : Bool #

Returns true if name is a valid string for a Vorbis Comment key, or false otherwise.


[View source]

Instance Method Detail

def <<(value : Tuple(String, String)) #

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.


[View source]
def [](name : String) : Array(String) #

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.


[View source]
def []=(key : String, value : String) #

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.


[View source]
def []?(name : String) : Array(String) | Nil #

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.


[View source]
def clear #

Removes all comments from this set, then returns self.


[View source]
def comments : Array(Tuple(String, String)) #

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.


[View source]
def delete(key : String, valNum : Int) : String #

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.


[View source]
def delete(key : String) #

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.


[View source]
def each(&) #

Loops over all of the comments, yielding each unique comment as a Tuple(String, String) to the block.


[View source]
def eachKey(&) #

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.


[View source]
def empty? #

Returns true if this set has no comments, or false otherwise.


[View source]
def numKeys #

Returns the number of unique key names stored in this set.


[View source]
def parse(rawData : Bytes, ignoreMissingFramingBit : Bool = false) : Int32 #

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.


[View source]
def parse(io : IO, ignoreMissingFramingBit : Bool = false) : Int32 #

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.


[View source]
def size : UInt32 #

Returns the total number of comments stored in this set.


[View source]
def vendor : String #

The vendor string for the Vorbis Comments set.


[View source]
def vendor=(vendor : String) #

The vendor string for the Vorbis Comments set.


[View source]
def write(io : IO, noFramingBit : Bool = false) : IO #

Writes this comment set to io, then returns io. If noFramingBit is true, then this will not write the framing bit at the end.


[View source]