eyed3 package


eyed3.compat module

Compatibility for various versions of Python (e.g. 2.6, 2.7, and 3.3)


byte strings units are ints

eyed3.compat.cmp(a, b)[source]
eyed3.compat.b(x, encoder=None)[source]

Convert the integer n to a single character byte string.


The utility handles the following difference with byte strings in Python 2 and 3:

b”123”[1] == b”2” (Python2) b”123”[1] == 50 (Python3)

As this function name implies, the oridinal value is returned given either a byte string of length 1 (python2) or a integer value (python3). With Python3 the value is simply return.


Imports a Ptyhon module referenced by absolute or relative path mod_file. The module is retured.

class eyed3.compat.UnicodeMixin[source]

Bases: object

A shim to handlke __unicode__ missing from Python3. Inspired by: http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/

eyed3.core module

Basic core types and utilities.

eyed3.core.AUDIO_NONE = 0

Audio type selecter for no audio.

eyed3.core.AUDIO_MP3 = 1

Audio type selecter for mpeg (mp3) audio.

eyed3.core.TXXX_ALBUM_TYPE = 'eyeD3#album_type'

A key that can be used in a TXXX frame to specify the type of collection (or album) a file belongs. See eyed3.core.ALBUM_TYPE_IDS.

eyed3.core.TXXX_ARTIST_ORIGIN = 'eyeD3#artist_origin'

A key that can be used in a TXXX frame to specify the origin of an artist/band. i.e. where they are from. The format is: city<tab>state<tab>country

eyed3.core.load(path, tag_version=None)[source]

Loads the file identified by path and returns a concrete type of eyed3.core.AudioFile. If path is not a file an IOError is raised. None is returned when the file type (i.e. mime-type) is not recognized. The following AudioFile types are supported:

If tag_version is not None (the default) only a specific version of metadata is loaded. This value must be a version constant specific to the eventual format of the metadata.

class eyed3.core.AudioInfo[source]

Bases: object

A base container for common audio details.

time_secs = 0

The number of seconds of audio data (i.e., the playtime)

size_bytes = 0

The number of bytes of audio data.

class eyed3.core.Tag(title=None, artist=None, album=None, album_artist=None, track_num=None)[source]

Bases: object

An abstract interface for audio tag (meta) data (e.g. artist, title, etc.)

read_only = False

Track number property. Must return a 2-tuple of (track-number, total-number-of-tracks). Either tuple value may be None.

class eyed3.core.AudioFile(path)[source]

Bases: object

Abstract base class for audio file types (AudioInfo + Tag)

Construct with a path and invoke _read. All other members are set to None.

rename(name, fsencoding='utf-8', preserve_file_time=False)[source]

Rename the file to name. The encoding used for the file name is eyed3.LOCAL_FS_ENCODING unless overridden by fsencoding. Note, if the target file already exists, or the full path contains non-existent directories the operation will fail with IOError. File times are not modified when preserve_file_time is True, False is the default.


Returns a concrete implemenation of eyed3.core.AudioInfo


Returns a concrete implemenation of eyed3.core.Tag


The absolute path of this file.

class eyed3.core.Date(year, month=None, day=None, hour=None, minute=None, second=None)[source]

Bases: object

A class for representing a date and time (optional). This class differs from datetime.datetime in that the default values for month, day, hour, minute, and second is None and not ‘January 1, 00:00:00’. This allows for an object that is simply 1987, and not January 1 12AM, for example. But when more resolution is required those vales can be set as well.

TIME_STAMP_FORMATS = ['%Y', '%Y-%m', '%Y-%m-%d', '%Y-%m-%dT%H', '%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S', '%Y-%m-%dT%HZ', '%Y-%m-%dT%H:%MZ', '%Y-%m-%dT%H:%M:%SZ', '%Y-%m-%d %H:%M:%S', '%Y-00-00']

Valid time stamp formats per ISO 8601 and used by c strptime.

static parse(s)[source]

Parses date strings that conform to ISO-8601.


A function that is invoked when non-fatal parse, format, etc. errors occur. In most cases the invalid values will be ignored or possibly fixed. This function simply logs the error.

eyed3.main module

eyed3.main.main(args, config)[source]
eyed3.main.profileMain(args, config)[source]

This is the main function for profiling http://code.google.com/appengine/kb/commontasks.html#profiling

eyed3.main.setFileScannerOpts(arg_parser, paths_metavar='PATH', paths_help='Files or directory paths')[source]

Module contents


The local encoding, used when parsing command line options, console output, etc. The default is always latin1 if it cannot be determined, it is NOT the value shown.

eyed3.LOCAL_FS_ENCODING = 'utf-8'

The local file system encoding, the default is latin1 if it cannot be determined.

exception eyed3.Error(*args)[source]

Bases: Exception

Base exception type for all eyed3 errors.