utils Package

utils Package

eyed3.utils.magic_func(path)[source]
eyed3.utils.guessMimetype(filename)[source]

Return the mime-type for filename. If available python-magic is used to provide better type detection.

eyed3.utils.walk(handler, path, excludes=None, fs_encoding='UTF-8')[source]

A wrapper around os.walk which handles exclusion patterns and unicode conversion.

class eyed3.utils.FileHandler[source]

Bases: object

A handler interface for eyed3.utils.walk() callbacks.

handleFile(f)[source]

Called for each file walked. The file f is the full path and the return value is ignored. If the walk should abort the method should raise a StopIteration exception.

handleDirectory(d, files)[source]

Called for each directory d after handleFile has been called for each file in files. StopIteration may be raised to halt iteration.

handleDone()[source]

Called when there are no more files to handle.

eyed3.utils.requireUnicode(*args)[source]

Function decorator to enforce unicode argument types. None is a valid argument value, in all cases, regardless of not being unicode. *args Positional arguments may be numeric argument index values (requireUnicode(1, 3) - requires argument 1 and 3 are unicode) or keyword argument names (requireUnicode(“title”)) or a combination thereof.

eyed3.utils.encodeUnicode(replace=True)[source]
eyed3.utils.formatTime(seconds, total=None, short=False)[source]

Format seconds (number of seconds) as a string representation. When short is False (the default) the format is:

HH:MM:SS.
Otherwise, the format is exacly 6 characters long and of the form:

1w 3d 2d 4h 1h 5m 1m 4s

15s

If total is not None it will also be formatted and appended to the result seperated by ‘ / ‘.

eyed3.utils.KB_BYTES = 1024

Number of bytes per KB (2^10)

eyed3.utils.MB_BYTES = 1048576

Number of bytes per MB (2^20)

eyed3.utils.GB_BYTES = 1073741824

Number of bytes per GB (2^30)

eyed3.utils.KB_UNIT = 'KB'

Kilobytes abbreviation

eyed3.utils.MB_UNIT = 'MB'

Megabytes abbreviation

eyed3.utils.GB_UNIT = 'GB'

Gigabytes abbreviation

eyed3.utils.formatSize(size, short=False)[source]

Format size (nuber of bytes) into string format doing KB, MB, or GB conversion where necessary.

When short is False (the default) the format is smallest unit of bytes and largest gigabytes; ‘234 GB’. The short version is 2-4 characters long and of the form

256b 64k 1.1G
eyed3.utils.formatTimeDelta(td)[source]

Format a timedelta object td into a string.

eyed3.utils.chunkCopy(src_fp, dest_fp, chunk_sz=524288)[source]

Copy src_fp to dest_fp in chunk_sz byte increments.

class eyed3.utils.ArgumentParser(*args, **kwargs)

Bases: argparse.ArgumentParser

Subclass of argparse.ArgumentParser that adds version and log level options.

class eyed3.utils.LoggingAction(*args, **kwargs)

Bases: argparse._AppendAction

eyed3.utils.datePicker(thing, prefer_recording_date=False)

This function returns a date of some sort, amongst all the possible dates (members called release_date, original_release_date, and recording_date of type eyed3.core.Date).

The order of preference is: 1) date of original release 2) date of this versions release 3) the recording date.

Unless prefer_recording_date is True in which case the order is 3, 1, 2.

None will be returned if no dates are available.

binfuncs Module

eyed3.utils.binfuncs.bytes2bin(bytes, sz=8)[source]

Accepts a string of bytes (chars) and returns an array of bits representing the bytes in big endian byte order. An optional max sz for each byte (default 8 bits/byte) which can be used to mask out higher bits.

eyed3.utils.binfuncs.bin2bytes(x)[source]
eyed3.utils.binfuncs.bin2dec(x)[source]

Convert x, an array of “bits” (MSB first), to it’s decimal value.

eyed3.utils.binfuncs.bytes2dec(bytes, sz=8)[source]
eyed3.utils.binfuncs.dec2bin(n, p=1)[source]

Convert a decimal value n to an array of bits (MSB first). Optionally, pad the overall size to p bits.

eyed3.utils.binfuncs.dec2bytes(n, p=1)[source]
eyed3.utils.binfuncs.bin2synchsafe(x)[source]

Convert x, a list of bits (MSB first), to a synch safe list of bits. (section 6.2 of the ID3 2.4 spec).

cli Module

This module is deprecated. Use eyed3.utils and eyed3.utils.console instead.

eyed3.utils.cli.getColor(color_code, fp=<open file '<stdout>', mode 'w' at 0x7eff1d317150>)[source]
eyed3.utils.cli.enableColorOutput(fp, state=True)[source]

log Module

class eyed3.utils.log.Logger(name)[source]

Bases: logging.Logger

Base class for all loggers

verbose(msg, *args, **kwargs)[source]

Log  msg at ‘verbose’ level, debug < verbose < info

Table Of Contents

Previous topic

plugins Package

Next topic

Compliance

This Page