From 9814c2977824543acb3ad39da2f94afc2feaf982 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 28 Sep 2015 22:50:56 +0200 Subject: Some example "known" numbers. --- callers/read_numbers_aloud.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'callers') diff --git a/callers/read_numbers_aloud.py b/callers/read_numbers_aloud.py index d74f08d..64d803c 100755 --- a/callers/read_numbers_aloud.py +++ b/callers/read_numbers_aloud.py @@ -7,18 +7,30 @@ from espeak import espeak class Speaker(object): + """Speak aloud something instead of calling numbers.""" def __init__(self, voice='europe/it'): espeak.set_voice(voice) + def _output(self, text): + print(text) + espeak.synth(text) + def speak(self, number): - print("Calling %s" % number) - espeak.synth(number) + try: + getattr(self, 'call_'+number, None)() + except TypeError: + self._output("Sto chiamando il numero %s" % number) + + def call_12345(self): + self._output(u"Questa รจ la combinazione della mia valigia.") + + def call_1234567890(self): + self._output(u"Stiamo testando tutti i numeri, vero?") class Reader(object): - """ - """ + """Read digits from stdin and turn them into phone numbers.""" def __init__(self): self.number = "" -- cgit v1.2.3