3.3. mktoc.disc¶
A set of classes for representation of audio CD information.
The following are a list of the classes provided in this module:
-
class
mktoc.disc.Disc[source]¶ Bases:
objectStores audio disc metadata values such as album title, performer, genre.
-
set_field(name, value)[source]¶ Set a disc field value as a class attributes.
This method provides additional formating to any data fields. For example, removing quoting and checking the field name.
Parameters: - name (str) – Field name to set
- value (str) – Value of field
Returns: Trueif field is written to the class data, orFalse
-
MODE_MULTI_SESSION= 'CD_ROM_XA'¶ Disc mode string for multi sessions
-
MODE_SINGLE_SESSION= 'CD_DA'¶ Disc mode string for single session
-
catalog= None¶ String representing the Catalog Id of a disc.
-
date= None¶ String representing the release year of a disc.
-
discid= None¶ String representing the DiscID value of a disc. This value is assumed to be correct and not verified by any internal logic.
-
genre= None¶ String representing the genre of a disc
-
is_multisession¶ Returns: Trueif disc is defined as multi-sesssion.
-
performer= None¶ String representing the performer or artist of a disc.
-
title= None¶ String representing the album title of a disc.
-
-
class
mktoc.disc.Track(num, is_data=False)[source]¶ Bases:
objectHolds track metadata values such as title and performer. Each
Trackobject contains a list ofTrackIndexs that specifies the audio data associated with the track.Parameters: - num (int) – Track index in the audio CD.
- is_data (bool) –
Trueif track is data instead of audio.
-
set_field(name, value)[source]¶ Set a track field value as a class attributes.
This method provides additional formating to any data fields. For example, removing quoting and checking the field name.
Parameters: - name (str) – Field name to set
- value (str) – Value of field
Returns: Trueif field is written to the class data, orFalse
-
dcp= False¶ TrueorFalse, indicates Digital Copy Protection flag on the track.
-
four_ch= False¶ TrueorFalse, indicates Four Channel Audio flag on the track.
-
indexes= None¶ list of
TrackIndexobjects. Every track has at least oneTrackIndexand possibly more. TheTrackIndexdefines a length of audio data or property in the track. The fistTrackIndexcan be pre-gap data. Only one audio file can be associated with aTrackIndex, so if a track is composed of multiple audio files, there will be an >= number ofTrackIndexs.
-
is_data= False¶ TrueorFalse, indicates if a track is binary data and not audio. Data tracks will not produce any text when printed.
-
isrc= None¶ String representing ISRC value of the track.
-
num= None¶ Integer initialized to the value of the track number.
-
performer= None¶ String representing the track artist.
-
pre= False¶ TrueorFalse, indicates Pre-Emphasis flag on the track.
-
pregap= None¶ _TrackTimevalue that indicates the pre-gap value of the current track. The pre-gap is a time length at the beginning of a track that will cause a CD player to count up from a negative time value before changing the track index number. The starting pre-gap value of a track is essentially the final audio at the end of the previous track. However, there is more than one way to designate the pregap in a track, therefore this variable is only used if the firstTrackIndexin the track contains more than just the pre-gap audio.
-
title= None¶ String representing the title of the track.
-
class
mktoc.disc.TrackIndex(num, time, file_, len_=None)[source]¶ Bases:
objectRepresent an index of an audio CD track.
Specifically, information about a location, length and type of audio data.
Trackobjects can have one or moreTrackIndexs to represent the audio data belonging to the track.Constants
-
PREAUDIO¶ Indicates a
TrackIndexthat is pre-gap audio data only.
-
AUDIO¶ Indicates a
TrackIndexof standard audio data or both pre-gap and audio.
-
INDEX¶ Indicates a
TrackIndexafter the start of a time stamp of a previousAUDIOTrackIndexobject. There is no audio data associated with INDEXTrackIndexs.
-
START¶ Same as
INDEX, butTrackIndexpreceding it is was the pre-gap audio of the sameTrack.
Attributes
-
file_¶ String representing a WAV file’s path and name. This is used to read the audio data of the
TrackIndex.
-
len_¶ Empty string or
_TrackTimevalue that specifies the number of audio frames associated with theTrackIndex. By default, this value will equal the total length of the WAV data, but might be truncated if the track starts after, or ends before the WAV data.
-
num¶ Integer specifying the location of the
TrackIndexin the track. The first index num is always 0.
-
time¶ _TrackTimevalue that specifies the starting time index of theTrackIndexobject relative to the start of the audio data. Usually this value is0.
If possible the sample count of the
TrackIndexis calculated by reading the WAV audio data.Parameters: - num (int) – Index number position in the
Track, starting at 0. - time (
_TrackTime) – The indexes starting offset in the audio data file. - file (str) – String representing the path location of a WAV file associated with this index.
- len (str, tuple, int (see
_TrackTime)) – Track length in format supported by_TrackTime.
-
AUDIO= 1
-
DATA= 4¶
-
INDEX= 2
-
PREAUDIO= 0
-
START= 3
-