Metadata¶
- xl.metadata.formats = {'669': <class 'xl.metadata.mod.ModFormat'>, 'xm': <class 'xl.metadata.mod.ModFormat'>, 'aiff': <class 'xl.metadata.wav.WavFormat'>, 's3m': <class 'xl.metadata.mod.ModFormat'>, 'mp4': <class 'xl.metadata.mp4.MP4Format'>, 'mp2': <class 'xl.metadata.mp3.MP3Format'>, 'mp3': <class 'xl.metadata.mp3.MP3Format'>, 'tta': <class 'xl.metadata.tta.TTAFormat'>, 'ape': <class 'xl.metadata.ape.MonkeysFormat'>, 'mka': <class 'xl.metadata.mka.MkaFormat'>, 'opus': None, 'wav': <class 'xl.metadata.wav.WavFormat'>, 'wma': <class 'xl.metadata.asf.AsfFormat'>, 'm4a': <class 'xl.metadata.mp4.MP4Format'>, 'mpc': <class 'xl.metadata.mpc.MpcFormat'>, 'far': <class 'xl.metadata.mod.ModFormat'>, 'amf': <class 'xl.metadata.mod.ModFormat'>, 'flac': <class 'xl.metadata.flac.FlacFormat'>, 'ogg': <class 'xl.metadata.ogg.OggFormat'>, 'oga': <class 'xl.metadata.ogg.OggFormat'>, 'mod': <class 'xl.metadata.mod.ModFormat'>, 'stm': <class 'xl.metadata.mod.ModFormat'>, 'ult': <class 'xl.metadata.mod.ModFormat'>, 'mtm': <class 'xl.metadata.mod.ModFormat'>, 'aif': <class 'xl.metadata.wav.WavFormat'>, 'shn': None, 'spx': <class 'xl.metadata.speex.SpeexFormat'>, 'ram': None, 'it': <class 'xl.metadata.mod.ModFormat'>, 'au': <class 'xl.metadata.wav.WavFormat'>, 'spc': None, 'okt': <class 'xl.metadata.mod.ModFormat'>, 'mid': None, 'ac3': None, 'dsm': <class 'xl.metadata.mod.ModFormat'>, 'ra': None, 'sid': <class 'xl.metadata.sid.SidFormat'>, 'med': <class 'xl.metadata.mod.ModFormat'>, 'snd': <class 'xl.metadata.wav.WavFormat'>, 'wv': <class 'xl.metadata.wv.WavpackFormat'>, 'asf': <class 'xl.metadata.asf.AsfFormat'>, 'midi': None, 'ogx': <class 'xl.metadata.ogg.OggFormat'>}¶
dictionary mapping extensions to Format classes.
- xl.metadata.get_format(loc)¶
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) - read_all()¶
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.