Fork me on GitHub
Release:
Date:
1.3
Feb 14, 2012
Flattr Mktoc

Table Of Contents

Download

Get latest source archive,
mktoc-1.3.tar.gz, or install with:

pip install mktoc --upgrade --user

Found a Bug?

Fill out a report on the issue tracker.

This Page

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: object

Stores 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:

True if field is written to the class data, or False

MODE_MULTI_SESSION

Disc mode string for multi sessions

MODE_SINGLE_SESSION

Disc mode string for single session

catalog

String representing the Catalog Id of a disc.

date

String representing the release year of a disc.

discid

String representing the DiscID value of a disc. This value is assumed to be correct and not verified by any internal logic.

genre

String representing the genre of a disc

is_multisession[source]
Returns:True if disc is defined as multi-sesssion.
performer

String representing the performer or artist of a disc.

title

String representing the album title of a disc.

class mktoc.disc.Track(num, is_data=False)[source]

Bases: object

Holds track metadata values such as title and performer. Each Track object contains a list of TrackIndexs that specifies the audio data associated with the track.

Parameters:
  • num (int) – Track index in the audio CD.
  • is_data (bool) – True if 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:

True if field is written to the class data, or False

dcp

True or False, indicates Digital Copy Protection flag on the track.

four_ch

True or False, indicates Four Channel Audio flag on the track.

indexes

list of TrackIndex objects. Every track has at least one TrackIndex and possibly more. The TrackIndex defines a length of audio data or property in the track. The fist TrackIndex can be pre-gap data. Only one audio file can be associated with a TrackIndex, so if a track is composed of multiple audio files, there will be an >= number of TrackIndexs.

is_data

True or False, indicates if a track is binary data and not audio. Data tracks will not produce any text when printed.

isrc

String representing ISRC value of the track.

num

Integer initialized to the value of the track number.

performer

String representing the track artist.

pre

True or False, indicates Pre-Emphasis flag on the track.

pregap

_TrackTime value 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 first TrackIndex in the track contains more than just the pre-gap audio.

title

String representing the title of the track.

class mktoc.disc.TrackIndex(num, time, file_, len_=None)[source]

Bases: object

Represent an index of an audio CD track.

Specifically, information about a location, length and type of audio data. Track objects can have one or more TrackIndexs to represent the audio data belonging to the track.

Constants

PREAUDIO

Indicates a TrackIndex that is pre-gap audio data only.

AUDIO

Indicates a TrackIndex of standard audio data or both pre-gap and audio.

INDEX

Indicates a TrackIndex after the start of a time stamp of a previous AUDIO TrackIndex object. There is no audio data associated with INDEX TrackIndexs.

START

Same as INDEX, but TrackIndex preceding it is was the pre-gap audio of the same Track.

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 _TrackTime value that specifies the number of audio frames associated with the TrackIndex. 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 TrackIndex in the track. The first index num is always 0.

time

_TrackTime value that specifies the starting time index of the TrackIndex object relative to the start of the audio data. Usually this value is 0.

If possible the sample count of the TrackIndex is 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.
cmd

Integer set to PREAUDIO or AUDIO or INDEX or START. Indicate the mode of TrackIndex object.