eyed3.mp3 package

Submodules

eyed3.mp3.headers module

eyed3.mp3.headers.isValidHeader(header)[source]

Determine if header (an integer, 4 bytes compared) is a valid mp3 frame header.

eyed3.mp3.headers.findHeader(fp, start_pos=0)[source]

Locate the first mp3 header in file stream fp starting a offset start_pos (defaults to 0). Returned is a 3-tuple containing the offset where the header was found, the header as an integer, and the header as 4 bytes. If no header is found header_int will equal 0.

eyed3.mp3.headers.timePerFrame(mp3_header, vbr)[source]

Computes the number of seconds per mp3 frame. It can be used to compute overall playtime and bitrate. The mp3 layer and sample rate from mp3_header are used to compute the number of seconds (fractional float point value) per mp3 frame. Be sure to set vbr True when dealing with VBR, otherwise playtimes may be incorrect.

eyed3.mp3.headers.compute_time_per_frame(mp3_header)[source]

Deprecated, use timePerFrame instead.

class eyed3.mp3.headers.Mp3Header(header_data=None)[source]

Bases: object

Header container for MP3 frames.

decode(header)[source]
class eyed3.mp3.headers.VbriHeader[source]

Bases: object

decode(frame)[source]
class eyed3.mp3.headers.XingHeader[source]

Bases: object

Header class for the Xing header extensions.

decode(frame)[source]
class eyed3.mp3.headers.LameHeader(frame)[source]

Bases: dict

Read the LAME info tag. frame should be the first frame of an mp3.

ENCODER_FLAGS = {'NSPSYTUNE': 1, 'NSSAFEJOINT': 2, 'NOGAP_NEXT': 4, 'NOGAP_PREV': 8}
PRESETS = {0: 'Unknown', 410: 'V9', 420: 'V8', 430: 'V7', 440: 'V6', 450: 'V5', 460: 'V4', 470: 'V3', 480: 'V2', 490: 'V1', 500: 'V0', 1000: 'r3mix', 1001: 'standard', 1002: 'extreme', 1003: 'insane', 1004: 'standard/fast', 1005: 'extreme/fast', 1006: 'medium', 1007: 'medium/fast'}
REPLAYGAIN_NAME = {0: 'Not set', 1: 'Radio', 2: 'Audiofile'}
REPLAYGAIN_ORIGINATOR = {0: 'Not set', 1: 'Set by artist', 2: 'Set by user', 3: 'Set automatically', 100: 'Set by simple RMS average'}
SAMPLE_FREQUENCIES = {0: '<= 32 kHz', 1: '44.1 kHz', 2: '48 kHz', 3: '> 48 kHz'}
STEREO_MODES = {0: 'Mono', 1: 'Stereo', 2: 'Dual', 3: 'Joint', 4: 'Force', 5: 'Auto', 6: 'Intensity', 7: 'Undefined'}
SURROUND_INFO = {0: 'None', 1: 'DPL encoding', 2: 'DPL2 encoding', 3: 'Ambisonic encoding', 8: 'Reserved'}
VBR_METHODS = {0: 'Unknown', 1: 'Constant Bitrate', 2: 'Average Bitrate', 3: 'Variable Bitrate method1 (old/rh)', 4: 'Variable Bitrate method2 (mtrh)', 5: 'Variable Bitrate method3 (mt)', 6: 'Variable Bitrate method4', 8: 'Constant Bitrate (2 pass)', 9: 'Average Bitrate (2 pass)', 15: 'Reserved'}
decode(frame)[source]

Decode the LAME info tag.

eyed3.mp3.headers.lamevercmp(x, y)[source]

Module contents

exception eyed3.mp3.Mp3Exception(*args)[source]

Bases: eyed3.Error

Used to signal mp3-related errors.

eyed3.mp3.MIME_TYPES = ['audio/mpeg', 'audio/mp3', 'audio/x-mp3', 'audio/x-mpeg', 'audio/mpeg3', 'audio/x-mpeg3', 'audio/mpg', 'audio/x-mpg', 'audio/x-mpegaudio']

Mime-types that are recognized at MP3

eyed3.mp3.OTHER_MIME_TYPES = ['application/octet-stream', 'audio/x-hx-aac-adts', 'audio/x-wav']

Mime-types that have been seen to contain mp3 data.

eyed3.mp3.EXTENSIONS = ['.mp3']

Valid file extensions.

eyed3.mp3.isMp3File(file_name)[source]

Does a mime-type check on file_name and returns True it the file is mp3, and False otherwise.

class eyed3.mp3.Mp3AudioInfo(file_obj, start_offset, tag)[source]

Bases: eyed3.core.AudioInfo

lame_tag = None

If not None, the Lame header. See eyed3.mp3.headers.LameHeader

bit_rate = None

2-tuple, (vrb?:boolean, bitrate:int)

bit_rate_str
class eyed3.mp3.Mp3AudioFile(path, version=(3, None, None))[source]

Bases: eyed3.core.AudioFile

Audio file container for mp3 files.

initTag(version=(2, 4, 0))[source]

Add a id3.Tag to the file (removing any existing tag if one exists).

tag

Returns a concrete implemenation of eyed3.core.Tag