Author: remi
Date: 2009-10-15 11:49:15 +0200 (Thu, 15 Oct 2009)
New Revision: 5673

Modified:
   software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py
   
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
Log:
* Added a global tts speak fixer object

Modified: software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py   
2009-10-15 09:30:59 UTC (rev 5672)
+++ software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py   
2009-10-15 09:49:15 UTC (rev 5673)
@@ -29,6 +29,7 @@
 from TDSResourcesManager import *
 from TDSConfiguration import *
 from TDSAutoUpdater import TDSAutoUpdater
+from translation.Translation import Translation
 
 # Create looger object
 logger = SimpleLogger("SmartServerMain")
@@ -57,6 +58,8 @@
     serverVersion = "%s-LINUX" % __version__
 # Create the base path of the configurations if not exists
 DirectoriesAndFilesTools.MKDirs(TDS_RESOURCES_CONF_PATH)
+# Define TTS fixer object.
+ttsFixer = Translation("tts_fixes")
 
 def initializeServer():
     """Initialize the server.

Modified: 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
      2009-10-15 09:30:59 UTC (rev 5672)
+++ 
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
      2009-10-15 09:49:15 UTC (rev 5673)
@@ -5,7 +5,6 @@
 
 import time
 
-from translation.Translation import Translation
 from util.string.String import String
 
 PGU_CONTEXT_LAYER_USER = 0
@@ -45,7 +44,6 @@
         self.__execStarted = False
         self.__execPaused = False
         self.__language = 
resourcePluginsServer.getPluginsContainer().getLanguage()
-        self.__translations = Translation("tts_fixes")
 
     def getPluginInterpreterContext(self):
         """
@@ -272,7 +270,7 @@
         if not self.executionIsStarted():
             resourceTuxDriver.closeMouth()
             return
-        text = self.__translations.fixeWordsInText(text, self.__language)
+        text = ttsFixer.fixeWordsInText(text, self.__language)
         resourceTuxOSL.ttsSpeak(text, locutor, pitch)
         if not self.executionIsStarted():
             resourceTuxDriver.closeMouth()
@@ -395,7 +393,6 @@
         self.__onDemandDictForThumbnailBarMutex = threading.Lock()
         self.__lastRunStopActionTime = time.time()
         self.__lastRunStopActionTimeMutex = threading.Lock()
-        self.__translations = Translation("tts_fixes")
 
     def insertOnDemand(self, ugc):
         """
@@ -425,13 +422,7 @@
             locutor = resourcePluginsServer.getPluginsContainer().getLocutor()
             pitch = resourcePluginsServer.getPluginsContainer().getPitch()
             language = 
resourcePluginsServer.getPluginsContainer().getLanguage()
-            transDict = self.__translations.getTranslations(language)
-            splitedName = ugcTtsName.lower().split(" ")
-            fixedName = ""
-            for i, word in enumerate(splitedName):
-                if transDict.has_key(word):
-                    splitedName[i] = transDict[word]
-                fixedName += splitedName[i] + " "
+            fixedName = ttsFixer.fixeWordsInText(ugcTtsName, language)
             resourceTuxDriver.openMouth()
             resourceTuxOSL.ttsSpeak(fixedName, locutor, pitch)
             if not eventsHandler.waitCondition(ST_NAME_TTS_SOUND_STATE, ("ON",


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to