[open-allure-ds] push by jg07...@gmail.com - Using swift and Spanish Marta voice on Mac. Unicode adjustments. on 2011-10-02 09:19 GMT

2 views
Skip to first unread message

open-al...@googlecode.com

unread,
Oct 2, 2011, 5:21:04 AM10/2/11
to open-al...@googlegroups.com
Revision: 3de774fde17d
Author: John Graves
Date: Sun Oct 2 02:19:15 2011
Log: Using swift and Spanish Marta voice on Mac. Unicode adjustments.
http://code.google.com/p/open-allure-ds/source/detail?r=3de774fde17d

Modified:
/odp2wts/odp2app.py
/odp2wts/odp2wts.py

=======================================
--- /odp2wts/odp2app.py Thu Sep 8 03:44:18 2011
+++ /odp2wts/odp2app.py Sun Oct 2 02:19:15 2011
@@ -10,7 +10,8 @@
import stat

APP = ['odp2wts.py']
-DATA_FILES =
['CHANGES.txt','ethics_notice.txt','README.txt','LICENSE.txt','soxi','MP4Box','ffmpeg']
+DATA_FILES = ['CHANGES.txt','ethics_notice.txt',
+'README.txt','LICENSE.txt','soxi','MP4Box','ffmpeg','silence22kHz.ogg']
OPTIONS = {'argv_emulation': True}

setup(
=======================================
--- /odp2wts/odp2wts.py Thu Sep 29 22:45:26 2011
+++ /odp2wts/odp2wts.py Sun Oct 2 02:19:15 2011
@@ -33,11 +33,11 @@

[questions=off]
"""
-__version__ = "0.1.22"
+__version__ = "0.1.24"

import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
-from ConfigParser import ConfigParser
+from configobj import ConfigObj
import codecs
import easygui
import math
@@ -88,15 +88,15 @@

# Check for last .odp file in config file
lastOdpFile = '~/*.odp'
-config = ConfigParser()
try:
- config.read(iniDirectory+os.sep+'odp2wts.ini')
- lastOdpFile = config.get("Files","lastOdpFile")
+ config = ConfigObj(iniDirectory+os.sep+'odp2wts.ini'),
+ lastOdpFile = config['Files']['lastOdpFile']
except:
- config.add_section("Files")
- config.set("Files","lastOdpFile","")
- with open(iniDirectory+os.sep+'odp2wts.ini', 'wb') as configfile:
- config.write(configfile)
+ config = ConfigObj()
+ config.filename = iniDirectory+os.sep+'odp2wts.ini'
+ config['Files'] = {}
+ config['Files']['lastOdpFile'] = lastOdpFile
+ config.write()

if not os.path.isfile(lastOdpFile):
lastOdpFile = None
@@ -250,9 +250,8 @@

if ((0 != len(odpFile)) and (os.path.exists(odpFilePath))):
# Save file name to config file
- config.set("Files","lastOdpFile",odpFilePath)
- with open(iniDirectory+os.sep+'odp2wts.ini', 'wb') as configfile:
- config.write(configfile)
+ config['Files']['lastOdpFile'] = lastOdpFile
+ config.write()

odpName = odpFile.replace(".odp","")
odp = ZipFile(odpFilePath,'r')
@@ -342,7 +341,23 @@
f.write('del '+imageFilePrefix+onImgStr+'.wav\n')
else:
# For Mac OSX
- f.write("/usr/bin/say -o "+imageFilePrefix+onImgStr+'.aiff "')
+# f.write("/usr/bin/say -o "+imageFilePrefix+onImgStr+'.aiff "')
+# lines = item.split("\n")
+# for linenum, line in enumerate(lines):
+# line.replace('"',' ').replace('`',' ').replace(';',' ')
+# if not line.startswith("["):
+# f.write(line+" ")
+# elif linenum>0:
+# break
+# # f.write(item)
+# f.write('"\n')
+# f.write("~/bin/sox "+imageFilePrefix+onImgStr+'.aiff "'+
+# odpFileSubdirectory+os.sep+imageFilePrefix+onImgStr+'.ogg"\n')
+# f.write("~/bin/sox "+imageFilePrefix+onImgStr+'.aiff "'+
+# odpFileSubdirectory+os.sep+imageFilePrefix+onImgStr+'.mp3"\n')
+# f.write("rm "+imageFilePrefix+onImgStr+'.aiff\n')
+
+ f.write("swift -n Marta -e utf-8 -m text
-o "+imageFilePrefix+onImgStr+'.wav "')
lines = item.split("\n")
for linenum, line in enumerate(lines):
line.replace('"',' ').replace('`',' ').replace(';',' ')
@@ -352,17 +367,17 @@
break
# f.write(item)
f.write('"\n')
- f.write("~/bin/sox "+imageFilePrefix+onImgStr+'.aiff "'+
+ f.write("~/bin/sox "+imageFilePrefix+onImgStr+'.wav "'+
odpFileSubdirectory+os.sep+imageFilePrefix+onImgStr+'.ogg"\n')
- f.write("~/bin/sox "+imageFilePrefix+onImgStr+'.aiff "'+
+ f.write("~/bin/sox "+imageFilePrefix+onImgStr+'.wav "'+
odpFileSubdirectory+os.sep+imageFilePrefix+onImgStr+'.mp3"\n')
- f.write("rm "+imageFilePrefix+onImgStr+'.aiff\n')
+ f.write("rm "+imageFilePrefix+onImgStr+'.wav\n')

def writeHtmlHeader(htmlFile):
htmlFile.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"' + "\n")
htmlFile.write('"http://www.w3.org/TR/html4/transitional.dtd">' + "\n")
htmlFile.write("<html>\n<head>\n")
- htmlFile.write('<meta HTTP-EQUIV=CONTENT-TYPE CONTENT="text/html;
charset=utf-8">' + "\n")
+ htmlFile.write('<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">' + "\n")
htmlFile.write('<title>Wiki-to-Speech</title>\n')

def writeHtmlHeader2(htmlFile):
@@ -541,7 +556,10 @@
f.write("~/bin/sox ")
for item in oggList:
f.write(imageFilePrefix+item+".ogg ")
- f.write('"'+savePath+os.sep+'silence.ogg" ')
+ if sys.platform.startswith("win"):
+ f.write('"'+savePath+os.sep+'silence.ogg" ')
+ else:
+ f.write('"'+savePath+os.sep+'silence22kHz.ogg" ')
f.write("all.ogg\n")
f.close()

Reply all
Reply to author
Forward
0 new messages