xl.metadata.formats = {'669': <class 'xl.metadata.mod.ModFormat'>, 'ac3': None, 'aif': <class 'xl.metadata.wav.WavFormat'>, 'aiff': <class 'xl.metadata.wav.WavFormat'>, 'amf': <class 'xl.metadata.mod.ModFormat'>, 'ape': <class 'xl.metadata.ape.MonkeysFormat'>, 'asf': <class 'xl.metadata.asf.AsfFormat'>, 'au': <class 'xl.metadata.wav.WavFormat'>, 'dsm': <class 'xl.metadata.mod.ModFormat'>, 'far': <class 'xl.metadata.mod.ModFormat'>, 'flac': <class 'xl.metadata.flac.FlacFormat'>, 'it': <class 'xl.metadata.mod.ModFormat'>, 'm4a': <class 'xl.metadata.mp4.MP4Format'>, 'med': <class 'xl.metadata.mod.ModFormat'>, 'mid': None, 'midi': None, 'mka': <class 'xl.metadata.mka.MkaFormat'>, 'mod': <class 'xl.metadata.mod.ModFormat'>, 'mp2': <class 'xl.metadata.mp3.MP3Format'>, 'mp3': <class 'xl.metadata.mp3.MP3Format'>, 'mp4': <class 'xl.metadata.mp4.MP4Format'>, 'mpc': <class 'xl.metadata.mpc.MpcFormat'>, 'mtm': <class 'xl.metadata.mod.ModFormat'>, 'oga': <class 'xl.metadata.ogg.OggFormat'>, 'ogg': <class 'xl.metadata.ogg.OggFormat'>, 'ogx': <class 'xl.metadata.ogg.OggFormat'>, 'okt': <class 'xl.metadata.mod.ModFormat'>, 'opus': None, 'ra': None, 'ram': None, 's3m': <class 'xl.metadata.mod.ModFormat'>, 'shn': None, 'sid': <class 'xl.metadata.sid.SidFormat'>, 'snd': <class 'xl.metadata.wav.WavFormat'>, 'spc': None, 'spx': <class 'xl.metadata.speex.SpeexFormat'>, 'stm': <class 'xl.metadata.mod.ModFormat'>, 'tta': <class 'xl.metadata.tta.TTAFormat'>, 'ult': <class 'xl.metadata.mod.ModFormat'>, 'wav': <class 'xl.metadata.wav.WavFormat'>, 'wma': <class 'xl.metadata.asf.AsfFormat'>, 'wv': <class 'xl.metadata.wv.WavpackFormat'>, 'xm': <class 'xl.metadata.mod.ModFormat'>}

dictionary mapping extensions to Format classes.


get a Format object appropriate for the file at loc. if no suitable object can be found, None is returned.

Parameters:loc – The location to read from. can be any gio-parseable path or uri.

Format Objects

exception xl.metadata.NotWritable
exception xl.metadata.NotReadable
class xl.metadata.BaseFormat(loc)

Base class for handling loading of metadata from files.

subclasses using mutagen should set MutagenType and overload the _get_tag, _set_tag, and _del_tag methods as needed.

subclasses not using mutagen should leave MutagenType as None

Raises NotReadable if the file cannot be opened for some reason.

Parameters:loc – absolute path to the file to read (note - this may change to accept gio uris in the future)

Reads all non-blacklisted tags from the file.

Blacklisted tags include lyrics, covers, and any field starting with __. If you need to read these, call read_tags directly.


get the values for the specified tags.

returns a dict of the found values. if no value was found for a requested tag it will not exist in the returned dict.

Parameters:tags – a list of tag names to read
Returns:a dictionary of tag/value pairs.

Write a set of tags to the file. Raises a NotWritable exception if the format does not support writing tags.

Parameters:tagdict – A dictionary of tag/value pairs to write.