|
@@ -80,7 +80,7 @@ class RepliesFactory(object):
|
|
|
@staticmethod
|
|
|
def convert_from_opus(opus_fname):
|
|
|
wav_file = tempfile.NamedTemporaryFile(delete=False, suffix=".wav").name
|
|
|
- subprocess.call("opusdec " + opus_fname + " " + wav_file, shell=True)
|
|
|
+ subprocess.call("opusdec --quiet " + opus_fname + " " + wav_file, shell=True)
|
|
|
return wav_file
|
|
|
|
|
|
def next(self):
|
|
@@ -95,10 +95,11 @@ class RepliesFactory(object):
|
|
|
result = random.choice(self._random_replies)
|
|
|
self._random_replies.remove(result)
|
|
|
|
|
|
+ original_file = result
|
|
|
result = self.convert_from_opus(result)
|
|
|
|
|
|
self._latest = result
|
|
|
- return result
|
|
|
+ return result, original_file
|
|
|
|
|
|
|
|
|
class ConversationStatus(Enum):
|
|
@@ -164,10 +165,10 @@ class SipConnection(object):
|
|
|
if self._conversation.status is not ConversationStatus.IMTALKING:
|
|
|
self._conversation.status = ConversationStatus.IMTALKING
|
|
|
|
|
|
- voice_filename = self._replies.next()
|
|
|
+ voice_filename, original_file = self._replies.next()
|
|
|
|
|
|
duration = get_wav_duration(voice_filename)
|
|
|
- self.log("Saying : " + voice_filename)
|
|
|
+ self.log("Saying : " + original_file)
|
|
|
|
|
|
core.play_file = voice_filename
|
|
|
|