python-mpd

ExampleMultiTags

Table of Content

How to deal with multi tag file

Multi tag files

Some tag formats (such as ID3v2 and VorbisComment) support defining the same tag multiple times, mostly for when a song has multiple artists. MPD supports this, and sends each occurrence of a tag to the client.

When python-mpd encounters the same tag more than once on the same song, it uses a list instead of a string.

Function to get a string only song object.


def collapse_tags(song): for tag, value in song.iteritems(): if isinstance(value, list): song[tag] = ", ".join(set(value))

Created: 3 years 8 months ago
by Geoff jack

Updated: 3 years 8 months ago
by Geoff jack