ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Util/info
Revision: 506
Committed: 2005-06-19T00:41:32-07:00 (20 years ago) by douglas
File size: 670 byte(s)
Log Message:
Stupid Python!

File Contents

# Content
1 #!/usr/bin/env python
2 # Decentralized Media
3 #
4 # Douglas Thrift
5 #
6 # $Id$
7
8 import eyeD3, sys
9
10 path = sys.argv[1]
11
12 def encode(string):
13 string = string.replace("&", "&")
14 string = string.replace("<", "&lt;")
15 string = string.replace("\"", "&quot;")
16 string = string.replace(">", "&gt;")
17 return string.encode("utf_8", "xmlcharrefreplace")
18
19 print """<file>
20 <path>%s</path>""" % (encode(path))
21
22 if eyeD3.isMp3File(path):
23 tag = eyeD3.Tag()
24 tag.link(path)
25 print u"""<artist>%s</artist>
26 <title>%s</title>
27 <album>%s</album>
28 <genre>%s</genre>""" % (encode(tag.getArtist()), encode(tag.getTitle()), encode(tag.getAlbum()), encode(tag.getGenre().getName()))
29
30 print "</file>"

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Id