def _process_upload(self, upl, session_id):
path = os.path.join(self.db.dbdir, '_attachments', upl['path'])
print 'processing', path
# XXX: use a tempdir
outdir = os.path.join(self.db.dbdir, upl['filename'])
sess = SocketTranscriptionSession(outdir, self.factory, session_id, self.factory.gen_hclg_filename)
BUF_LEN = 200
for chunk in numm3.sound_chunks(path, nchannels=1, R=8000, chunksize=BUF_LEN):
sess.feed(chunk)
sess.stop()
sess.join()
# Clean up: remove the tempdir and the original upload
os.removedirs(outdir)
os.remove(path)
评论列表
文章目录