From cfc1dfb1ca7fadbd5a716be1b83fc74f8ea954dd Mon Sep 17 00:00:00 2001 From: chrys Date: Thu, 7 Jul 2016 01:07:46 +0200 Subject: [PATCH] did some renaming for members --- src/fenrir.py | 6 +++--- src/speech/es.py | 32 ++++++++++++++++---------------- src/speech/sd.py | 40 ++++++++++++++++++++-------------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/fenrir.py b/src/fenrir.py index 39b44c96..5a6713c7 100755 --- a/src/fenrir.py +++ b/src/fenrir.py @@ -7,7 +7,7 @@ import hashlib import difflib import textwrap import speech.es as es -#import speech.sd as sd +import speech.sd as sd runtime = { 'running':True, @@ -25,8 +25,8 @@ runtime = { 'newContentAttrib': b'', 'oldTTY':'0', 'newTTY':'0', -'speechDriverString':'es', -'speechDriver': es.speech() +'speechDriverString':'sd', +'speechDriver': sd.speech() } while(runtime['running']): diff --git a/src/speech/es.py b/src/speech/es.py index d8eb3749..0ec32693 100644 --- a/src/speech/es.py +++ b/src/speech/es.py @@ -4,48 +4,48 @@ class speech(): def __init__(self, ): - self.es = None - self.isInitialized = False + self._es = None + self._isInitialized = False try: from espeak import espeak - self.es = espeak - self.isInitialized = True + self._es = espeak + self._isInitialized = True except: - self.initialized = False + self._initialized = False def speak(self,text, queueable=True): - if not self.isInitialized: + if not self._isInitialized: return False if queueable == False: self.cancel() - self.es.synth(text) + self._es.synth(text) return True def cancel(self): - if not self.isInitialized: + if not self._isInitialized: return False - self.es.cancel() + self._es.cancel() return True def clear_buffer(self): - if not self.isInitialized: + if not self._isInitialized: return False return True def setVoice(self, voice): - if not self.isInitialized: + if not self._isInitialized: return False - return es.set_voice('de') + return _es.set_voice('de') def setPitch(self, pitch): - if not self.isInitialized: + if not self._isInitialized: return False - return es.set_parameter(espeak.Parameter.Pitch, pitch) + return _es.set_parameter(espeak.Parameter.Pitch, pitch) def setSpeed(self, speed): - if not self.isInitialized: + if not self._isInitialized: return False - return es.set_parameter(espeak.Parameter.Rate, speed) + return _es.set_parameter(espeak.Parameter.Rate, speed) def setModule(self, module): pass diff --git a/src/speech/sd.py b/src/speech/sd.py index 4fb37796..ddce7504 100644 --- a/src/speech/sd.py +++ b/src/speech/sd.py @@ -3,67 +3,67 @@ # speech-dispatcher driver class speech(): - def __init__(self, ): - self.sd = None - self.isInitialized = False + def __init__(self ): + self._sd = None + self._isInitialized = False try: import speechd - self.sd = speechd.SSIPClient('fenrir') - self.isInitialized = True + self._sd = speechd.SSIPClient('fenrir') + self._isInitialized = True except: - self.initialized = False + self._initialized = False def speak(self,text, queueable=True): - if not self.isInitialized: + if not self._isInitialized: return False if queueable == False: self.cancel() - self.sd.speak(text) + self._sd.speak(text) return True def cancel(self): - if not self.isInitialized: + if not self._isInitialized: return False - self.sd.cancel() + self._sd.cancel() return True def clear_buffer(self): - if not self.isInitialized: + if not self._isInitialized: return False return True def setVoice(self, voice): - if not self.isInitialized: + if not self._isInitialized: return False try: - self.sd.set_voice(voice) + self._sd.set_voice(voice) return True except: return False def setPitch(self, pitch): - if not self.isInitialized: + if not self._isInitialized: return False try: - self.sd.set_pitch(pitch) + self._sd.set_pitch(pitch) return True except: return False def setSpeed(self, speed): - if not self.isInitialized: + if not self._isInitialized: return False try: - self.sd.set_rate(speed) + self._sd.set_rate(speed) return True except: return False def setModule(self, module): - if not self.isInitialized: + if not self._isInitialized: return False try: - self.sd.set_output_module(module) + self._sd.set_output_module(module) return True except: return False @@ -71,4 +71,4 @@ class speech(): def shutdown(self): self.cancel() - self.sd.close() + self._sd.close()