Browse Source

[Fix] disable voicerss for python3, waiting for dependencies to be fixed

ThiBuff 7 years ago
parent
commit
5356c73c09
2 changed files with 29 additions and 14 deletions
  1. 1 1
      kalliope/tts/pico2wave/pico2wave.py
  2. 28 13
      kalliope/tts/voicerss/voicerss.py

+ 1 - 1
kalliope/tts/pico2wave/pico2wave.py

@@ -61,7 +61,7 @@ class Pico2wave(TTSModule):
         final_command.extend(pico2wave_options)
         final_command.append(self.words)
 
-        logger.debug("Pico2wave command: %s" % final_command)
+        logger.debug("[Pico2wave] command: %s" % final_command)
 
         # generate the file with pico2wav
         subprocess.call(final_command)

+ 28 - 13
kalliope/tts/voicerss/voicerss.py

@@ -1,11 +1,21 @@
+import logging
+import sys
+
 from kalliope.core import FileManager
 from kalliope.core.TTS.TTSModule import TTSModule, MissingTTSParameter
-import logging
-from voicerss_tts.voicerss_tts import TextToSpeech
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")
 
+# TODO : voicerss lib dependancies are not working as expected in python3
+# CF: git : https://github.com/kalliope-project/kalliope/pull/397
+# TODO : remove this check, when fixed :
+# https://bitbucket.org/daycoder/cachingutil/pull-requests/1/fix-python3-packages-paths/diff
+if sys.version_info[0] == 3:
+    logger.error("[Voicerss] WARNING : VOICERSS is not working for python3 yet !")
+else :
+    from voicerss_tts.voicerss_tts import TextToSpeech
+
 TTS_URL = "http://www.voicerss.org/controls/speech.ashx"
 TTS_CONTENT_TYPE = "audio/mpeg"
 TTS_TIMEOUT_SEC = 30
@@ -50,15 +60,20 @@ class Voicerss(TTSModule):
         .. raises:: FailToLoadSoundFile
         """
         voicerss = TextToSpeech(
-             api_key=self.key,
-             text= self.words,
-             language=self.language,
-             rate=self.rate,
-             codec=self.codec,
-             audio_format=self.audio_format,
-             ssml=self.ssml,
-             base64=self.base64,
-             ssl=self.ssl)
+            api_key=self.key,
+            text=self.words,
+            language=self.language,
+            rate=self.rate,
+            codec=self.codec,
+            audio_format=self.audio_format,
+            ssml=self.ssml,
+            base64=self.base64,
+            ssl=self.ssl)
 
-        # OK we get the audio we can write the sound file
-        FileManager.write_in_file(self.file_path, voicerss.speech)
+        # TODO : voicerss lib dependancies are not working as expected in python3
+        # CF: git : https://github.com/kalliope-project/kalliope/pull/397
+        # TODO : remove this check, when fixed :
+        # https://bitbucket.org/daycoder/cachingutil/pull-requests/1/fix-python3-packages-paths/diff
+        if sys.version_info[0] < 3:
+            # OK we get the audio we can write the sound file
+            FileManager.write_in_file(self.file_path, voicerss.speech)