xl.metadata.formats = {'669': <class 'xl.metadata.mod.ModFormat'>, 'aac': [<class 'xl.metadata.mp4.MP4Format'>, <class 'xl.metadata.aac.AACFormat'>], 'ac3': None, 'aif': <class 'xl.metadata.aiff.AIFFFormat'>, 'aifc': <class 'xl.metadata.aiff.AIFFFormat'>, 'aiff': <class 'xl.metadata.aiff.AIFFFormat'>, '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': <class 'xl.metadata.ogg.OggOpusFormat'>, '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.

xl.metadata.get_format(loc: str) → Optional[xl.metadata._base.BaseFormat][source]

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 as a Gio URI (from Track.get_loc_for_io())

Format Objects

exception xl.metadata.NotWritable[source]
exception xl.metadata.NotReadable[source]
class xl.metadata.BaseFormat(loc)[source]

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


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 exaile 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.

When calling this function, we assume the following:

  • tagdict has all keys that you wish to write, keys are exaile tag names or custom tag names and values are the tags to write (lists of unicode strings)
  • if a value is None, then that tag will be deleted from the file
  • Will not modify/delete tags that are NOT in tagdict
  • Will not write tags that start with ‘__’
Parameters:tagdict – A dictionary of tag/value pairs to write.