3.5. mktoc.parser¶
This module provides object(s) to parse text files describing the layout of an audio CD. After the parse step is complete, it is possible to access the data or convert into any other output format.
The following are a list of the classes provided in this module:
-
class
mktoc.parser.CueParser(dir_='.', find_wav=True)[source]¶ Bases:
objectAn audio CUE sheet text file parsing class.
By matching the known format of a CUE file, the relevant text information is extracted and converted to a binary representation. The binary representation is created by using combination of Disc, Track, and TrackIndex objects. With the data, the CUE file can be re-created or converted into a new format.
Parameters: - dir (str) – Path location of the CUE file’s directory.
- find_wav (bool) –
True/False,Truecauses exceptions to be raised if a WAV file can not be found in the FS.
-
class
mktoc.parser.WavParser(dir_='.', find_wav=True)[source]¶ Bases:
objectA simple parser object that uses a list of WAV files to create a CD TOC.
The class assumes that each WAV file is an individual track, in ascending order.
Parameters: - dir (str) – Path location of the CUE file’s directory.
- find_wav (bool) –
True/False,Truecauses exceptions to be raised if a WAV file can not be found in the FS.
-
class
mktoc.parser.ParseData(disc, tracks, files)[source]¶ Bases:
objectStores parsed CD-ROM data and provides methods for modifcation and access.
Automatically generated by invoking the
parse()method defined in one of the_Parserclasses.Initialize data structures.
Parameters: - disc (
Disc) – CD info data object - tracks (
list()of class:disc.Track) – a lost of objects with track info and indexes for each portion of the track. - files (
list()of file name strs) – in-order list of WAV files associated with ‘tracks’
-
modWavOffset(samples, tmp=False)[source]¶ Optional method to correct the audio WAV data by shifting the samples by a positive or negative offset.
This can be used to compensate for a write offset in a CD/DVD burner. If the tmp variable is
True, all new WAV files will be created in the :file;`/tmp` directory.Parameters: - samples (int) – Number of samples to shift the audio data by. This value can be negative or positive.
- tmp (bool) –
TrueorFalse; whenTrueany new WAV files will be created in/tmp.
-
last_index¶ Reference to last index of last track.
- disc (