File: multitags.py

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