class RemiAudio::Cue
- RemiAudio::Cue
- Reference
- Object
Overview
A virtual representation of a CUE sheet.
Example that lists the files/tracks of a CUE sheet, then saves the CUE sheet to a new file.
require "remiaudio/cue"
cue = RemiAudio::Cue.load("/path/to/file.cue")
cue.files.each do |file|
puts "File: #{file.filename}"
file.tracks.each do |track|
if title = track.title
puts " #{title}"
else
puts " Unnamed track, number #{track.trackNumber}"
end
end
end
# Write the CUE to a new file
File.open("/path/to/newcue.cue", "w") do |file|
cue.write(file)
end
Documentation for the CUE sheet format can be found at these sources:
- https://web.archive.org/web/20070614044112/http://www.goldenhawk.com/download/cdrwin.pdf
- https://wiki.hydrogenaud.io/index.php?title=Cue_sheet
- https://github.com/libyal/libodraw/blob/main/documentation/CUE%20sheet%20format.asciidoc
Defined in:
remiaudio/cue.crConstant Summary
-
CATALOG_LEN =
13 -
The expected length of the CATALOG field, in bytes.
-
MAX_PERFORMER_LEN =
80 -
The maximum length of the PERFORMER field, in bytes.
-
MAX_SONGWRITER_LEN =
80 -
The maximum length of the SONGWRITER field, in bytes.
-
MAX_TITLE_LEN =
80 -
The maximum length of the TITLE field, in bytes.
-
MIN_PERFORMER_LEN =
1 -
The minimum length of the PERFORMER field, in bytes.
-
MIN_SONGWRITER_LEN =
1 -
The minimum length of the SONGWRITER field, in bytes.
-
MIN_TITLE_LEN =
1 -
The minimum length of the TITLE field, in bytes.
Constructors
-
.load(filename : Path | String, *, strict : Bool = false) : Cue
Creates a new
Cueinstance by loading and parsing the specified file. -
.new
Creates a new, blank
Cueinstance. -
.parse(io : IO, *, strict : Bool = false) : Cue
Creates a new
Cueinstance by parsing data from io. -
.parse(string : String, *, strict : Bool = false) : Cue
Creates a new
Cueinstance by parsing data from the given string.
Instance Method Summary
-
#addFile(&) : File
Creates a new
RemiAudio::Cue::Fileand yields it to the block. -
#catalog : String | Nil
The "Media Catalog Number" for this CUE sheet.
-
#catalog=(value : String) : Nil
Sets the "Media Catalog Number" for this CUE sheet.
-
#cdTextFile : String | Nil
The path to an external file that contains CD-TEXT information for this CUE sheet.
-
#cdTextFile=(cdTextFile : String | Nil)
The path to an external file that contains CD-TEXT information for this CUE sheet.
-
#files : Array(RemiAudio::Cue::File)
The
RemiAudio::Cue::Files for this CUE sheet. -
#files=(files : Array(RemiAudio::Cue::File))
The
RemiAudio::Cue::Files for this CUE sheet. -
#performer : String | Nil
The performer of this CUE sheet.
-
#performer=(value : String | Nil) : Nil
Sets the name of the performer for this track.
-
#songwriter : String | Nil
The songwriter of this CUE sheet.
-
#songwriter=(value : String | Nil) : Nil
Sets the name of the songwriter for this track.
-
#sortAndCheckTracks : Bool
Sorts all
RemiAudio::Cue::File#tracksin all#files, then attempts to sort#filesaccording to their tracks, then ensures that that all of the tracks are in sequential order. -
#title : String | Nil
The title of this CUE sheet.
-
#title=(value : String | Nil) : Nil
Sets the name of the title for this track.
-
#write(io : IO) : Nil
Writes this CUE sheet to io.
-
#write : String
Writes this CUE sheet to a string and returns it.
Constructor Detail
Creates a new Cue instance by loading and parsing the specified file.
See .parse(io : IO, *, strict : Bool = false) for information about the
strict parameter.
Creates a new Cue instance by parsing data from io. If strict is
true, then certain restrictions are in place for the following cases:
- Unrecognized commands in the
FILEsection will not be accepted. - Unrecognized commands in the
TRACKsection will not be accepted. - Unrecognized
FLAGSon a FLAG line within aTRACKwill not be accepted.
When strict is false, then these cases are silently ignored.
Creates a new Cue instance by parsing data from the given string.
See .parse(io : IO, *, strict : Bool = false) for information about the
strict parameter.
Instance Method Detail
Creates a new RemiAudio::Cue::File and yields it to the block. When the
block exits, the new file is added to this Cue. The new file is
returned.
The "Media Catalog Number" for this CUE sheet. This is generally a UPC or EAN code.
Sets the "Media Catalog Number" for this CUE sheet. This is generally a
UPC or EAN code. This must be exactly CATALOG_LEN bytes in length.
The path to an external file that contains CD-TEXT information for this CUE sheet.
The path to an external file that contains CD-TEXT information for this CUE sheet.
The RemiAudio::Cue::Files for this CUE sheet.
The RemiAudio::Cue::Files for this CUE sheet.
Sets the name of the performer for this track. The value must be between
MIN_PERFORMER_LEN and MAX_PERFORMER_LEN bytes long.
Sets the name of the songwriter for this track. The value must be between
MIN_SONGWRITER_LEN and MAX_SONGWRITER_LEN bytes long.
Sorts all RemiAudio::Cue::File#tracks in all #files, then attempts to
sort #files according to their tracks, then ensures that that all of the
tracks are in sequential order. If the tracks are not sequential after
sorting, or there are duplicates, this returns false. Otherwise it
returns true.
Sets the name of the title for this track. The value must be between
MIN_TITLE_LEN and MAX_TITLE_LEN bytes long.
Writes this CUE sheet to io. This will automatically call
#sortAndCheckTracks before writing any data.
Writes this CUE sheet to a string and returns it. This will automatically
call #sortAndCheckTracks before writing any data.