kaa_metadata Package

kaa_metadata Package

core Module

class pytomo.kaa_metadata.core.Collection[source]

Bases: pytomo.kaa_metadata.core.Media

Collection of Digial Media like CD, DVD, Directory, Playlist

class pytomo.kaa_metadata.core.Media(hash=None)[source]

Bases: object

convert()[source]

Convert Media to dict.

get(attr, default=None)[source]

Returns the given attribute. If the attribute is not set by the parser return ‘default’.

has_key(key)[source]

Check if the object has an attribute ‘key’

keys()[source]

Return all keys for the attributes set by the parser.

media = None

Media is the base class to all Media Metadata Containers. It defines the basic structures that handle metadata. Media and its derivates contain a common set of metadata attributes that is listed in keys. Specific derivates contain additional keys to the dublin core set that is defined in Media.

table_mapping = {}
exception pytomo.kaa_metadata.core.ParseError[source]

Bases: exceptions.Exception

factory Module

pytomo.kaa_metadata.factory.register(mimetype, extensions, c, magic=None)[source]

Register a parser to the factory.

pytomo.kaa_metadata.factory.gettype(mimetype, extensions)[source]

Return parser for mimetype / extensions

pytomo.kaa_metadata.factory.parse(filename, force=True)[source]

parse a file

fourcc Module

pytomo.kaa_metadata.fourcc.resolve(code)[source]

Transform a twocc or fourcc code into a name. Returns a 2-tuple of (cc, codec) where both are strings and cc is a string in the form ‘0xXX’ if it’s a twocc, or ‘ABCD’ if it’s a fourcc. If the given code is not a known twocc or fourcc, the return value will be (None, ‘Unknown’), unless the code is otherwise a printable string in which case it will be returned as the codec.

language Module

pytomo.kaa_metadata.language.resolve(code)[source]

Transform the given (2- or 3-letter) language code to a human readable language name. The return value is a 2-tuple containing the given language code and the language name. If the language code cannot be resolved, name will be ‘Unknown (<code>)’.

strutils Module

pytomo.kaa_metadata.strutils.get_encoding()[source]

Return the current encoding.

pytomo.kaa_metadata.strutils.set_encoding(encoding)[source]

Set default character encoding. This function also sets the global Python encoding.

pytomo.kaa_metadata.strutils.utf8(s)[source]

Returns a UTF-8 string, converting from other character sets if necessary.

pytomo.kaa_metadata.strutils.str_to_unicode(s, encoding=None)[source]

Attempts to convert a string of unknown character set to a unicode string. First it tries to decode the string based on the locale’s preferred encoding, and if that fails, fall back to UTF-8 and then latin-1. If all fails, it will force encoding to the preferred charset, replacing unknown characters. If the given object is no string, this function will return the given object.

pytomo.kaa_metadata.strutils.unicode_to_str(s, encoding=None)[source]

Attempts to convert a unicode string of unknown character set to a string. First it tries to encode the string based on the locale’s preferred encoding, and if that fails, fall back to UTF-8 and then latin-1. If all fails, it will force encoding to the preferred charset, replacing unknown characters. If the given object is no unicode string, this function will return the given object.

pytomo.kaa_metadata.strutils.format(s, *args)[source]

Format a string and make sure all string or unicode arguments are converted to the correct type.

pytomo.kaa_metadata.strutils.to_unicode(s, encoding=None)[source]

Attempts to convert every object to an unicode string using the objects __unicode__ or __str__ function or str_to_unicode.

pytomo.kaa_metadata.strutils.to_str(s, encoding=None)[source]

Attempts to convert every object to a string using the objects __unicode__ or __str__ function or unicode_to_str.

version Module

Table Of Contents

Previous topic

scripts Package

Next topic

audio Package

This Page