File: multitags.py

package info (click to toggle)
python-mpd 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 472 kB
  • sloc: python: 3,148; makefile: 201; sh: 9
file content (12 lines) | stat: -rw-r--r-- 540 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
# 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))