From 99a85144b02fb3c595cae7c41cf6e88226b98e39 Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Tue, 12 Jul 2011 15:42:24 +0000
Subject: [PATCH] Gradint update

git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/gradint@1164 29193198-4895-4776-b068-10539e920549
---
 gradint-build/src/frontend.py | 11 ++++++++---
 gradint-build/src/synth.py    |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py
index 201f394..3c0c885 100644
--- a/gradint-build/src/frontend.py
+++ b/gradint-build/src/frontend.py
@@ -1652,7 +1652,6 @@ def transliterates_differently(text,lang):
     translit=synth.transliterate(lang,text,forPartials=0)
     if translit and not translit==text: return translit
 
-gui_output_counter = 1
 def gui_outputTo_start():
     if hasattr(app,"outputTo") and app.outputTo.get() and not app.outputTo.get()=="0":
         global outputFile,gui_output_directory,oldGID ; outputFile=None
@@ -1665,9 +1664,15 @@ def gui_outputTo_start():
         if type(gui_output_directory)==type([]): gui_output_directory=gui_output_directory[-1]
         try: os.mkdir(gui_output_directory)
         except: pass
-        global gui_output_counter
+        gui_output_counter = 1 # now local because we also got prefix
+        if justSynthesize:
+            if '#' in justSynthesize[1:]: prefix="" # multiple languages
+            else: # prefix the language that's being synth'd
+                prefix=justSynthesize.split()[0]
+                if prefix.startswith('#'): prefix=prefix[1:]
+        else: prefix = "lesson"
         while not outputFile or fileExists(outputFile):
-            outputFile=gui_output_directory+os.sep+str(gui_output_counter)+extsep+app.outputTo.get()
+            outputFile=gui_output_directory+os.sep+prefix+str(gui_output_counter)+extsep+app.outputTo.get()
             gui_output_counter += 1
         global write_to_stdout ; write_to_stdout = 0
         global out_type ; out_type = app.outputTo.get()
diff --git a/gradint-build/src/synth.py b/gradint-build/src/synth.py
index 7b2b406..4b43af7 100644
--- a/gradint-build/src/synth.py
+++ b/gradint-build/src/synth.py
@@ -958,7 +958,7 @@ class SynthEvent(Event):
                 except IOError:
                     time.sleep(1) ; continue
                 return e.play()
-            raise IOError("IOError after 10 tries")
+            raise IOError("IOError after 10 tries on "+repr(self.sound))
         else:
             assert (not soundCollector) and hasattr(self.synthesizer,"play"),"Should have called will_be_played before playing offline"
             return self.synthesizer.play(self.language,self.modifiedText)
-- 
GitLab