Martin 10 lat temu
rodzic
commit
f178db46f2

+ 2 - 0
voice_control/services/__init__.py

@@ -5,6 +5,7 @@ import input_sources
 import output
 import current_time
 import help
+import echo
 
 def _get_services():
     services = {
@@ -12,6 +13,7 @@ def _get_services():
         'food': todo_wunderlist.Wunderlist(True, 'food'),
         'todo': todo_wunderlist.Wunderlist(False),
         'time': current_time.CurrentTime('Europe/Dublin'),
+        'echo': echo.Echo(),
         #'play': music.Music(),
     }
 

+ 12 - 0
voice_control/services/echo.py

@@ -0,0 +1,12 @@
+import input_sources
+import base
+import output
+
+class Echo(base.BaseService):
+    def call(self):
+        tokens = []
+        while input_sources.token_available():
+            tokens.append(input_sources.get_token(0))
+        
+        if tokens:
+            output.tts(' '.join(tokens))