python filters: create common main program inside rclexecm.py to help with testing

This commit is contained in:
Jean-Francois Dockes
2010-11-16 15:51:31 +01:00
parent d99865dbda
commit 9e994c4f62
6 changed files with 63 additions and 73 deletions
+4 -3
View File
@@ -37,7 +37,6 @@ class AudioTagExtractor:
def __init__(self, em):
self.em = em
self.currentindex = 0
self.em.setmimetype("text/html")
def extractone(self, params):
#self.em.rclog("extractone %s %s" % (params["filename:"], params["mimetype:"]))
@@ -76,6 +75,7 @@ class AudioTagExtractor:
title = self.em.htmlescape(tags["title"][0].encode("utf-8"))
except:
pass
self.em.setmimetype("text/html")
alldata = self.em.htmlescape(tags.pprint().encode("utf-8"))
alldata = alldata.replace("\n", "<br>")
docdata = htmltemplate % (album, artist, title, alldata)
@@ -98,5 +98,6 @@ class AudioTagExtractor:
self.currentindex += 1
return ret
e = rclexecm.RclExecM()
e.mainloop(AudioTagExtractor(e))
proto = rclexecm.RclExecM()
extract = AudioTagExtractor(proto)
rclexecm.main(proto, extract)