#!/usr/bin/env python # Decentralized Media # # Douglas Thrift # # $Id$ import eyeD3, sys path = sys.argv[1] def encode(string): string = string.replace("&", "&") string = string.replace("<", "<") string = string.replace("\"", """) string = string.replace(">", ">") return string.encode("utf_8", "xmlcharrefreplace") print """ %s""" % (encode(path)) if eyeD3.isMp3File(path): tag = eyeD3.Tag() tag.link(path) print u"""%s %s %s %s""" % (encode(tag.getArtist()), encode(tag.getTitle()), encode(tag.getAlbum()), encode(tag.getGenre().getName())) print ""