From 2de9c62083f7059e675701ec0add65e660723741 Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 12 Jun 2018 10:26:32 +0200 Subject: [PATCH] Adapt to new server --- tools/rc22/tts.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/rc22/tts.py b/tools/rc22/tts.py index 38914dcb4..fc42cfeb6 100755 --- a/tools/rc22/tts.py +++ b/tools/rc22/tts.py @@ -23,6 +23,9 @@ from gtts import gTTS from tts_common import * board = "taranis" +reload(sys) +sys.setdefaultencoding('utf8') + SOURCE_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) lib_path = os.path.abspath(os.path.join(SOURCE_DIRECTORY, '..', '..', 'radio', 'util')) sys.path.append(lib_path) @@ -101,7 +104,7 @@ if __name__ == "__main__": if "csv" in sys.argv: path = "/tmp/SOUNDS/" + directory + "/SYSTEM/" if not os.path.exists(path): - os.makedirs(path) + os.makedirs(path) os.chdir(path) with open("%s-%s.csv" % (voice, board), "wb") as csvFile: for s, f in systemSounds: @@ -122,7 +125,7 @@ if __name__ == "__main__": if "psv" in sys.argv: path = "/tmp/SOUNDS/" + directory + "/" if not os.path.exists(path): - os.makedirs(path) + os.makedirs(path) os.chdir(path) with open("%s-%s.psv" % (voice, board), "wb") as csvFile: for s, f in systemSounds: @@ -134,15 +137,16 @@ if __name__ == "__main__": l = u"|" + f.replace(".wav", "") + u"|" + s + u"\r\n" csvFile.write(l.encode("windows-1251")) + if "files" in sys.argv: - path = "/tmp/SOUNDS/" + directory + "/SYSTEM/" - if not os.path.exists(path): - os.makedirs(path) - os.chdir(path) - for s, f in systemSounds: - if s and f: - generate(s, f) - os.chdir("..") - for s, f in sounds: - if s and f: - generate(s, f) + path = "/tmp/SOUNDS/" + directory + "/SYSTEM/" + if not os.path.exists(path): + os.makedirs(path) + os.chdir(path) + for s, f in systemSounds: + if s and f: + generate(s, f) + os.chdir("..") + for s, f in sounds: + if s and f: + generate(s, f)