Bläddra i källkod

add input/output service controls to the conf file

Martin 10 år sedan
förälder
incheckning
349efc39fb
3 ändrade filer med 21 tillägg och 6 borttagningar
  1. 9 2
      voice_control/conf.py
  2. 6 2
      voice_control/input_sources/__init__.py
  3. 6 2
      voice_control/output/__init__.py

+ 9 - 2
voice_control/conf.py

@@ -1,9 +1,16 @@
 import os
 
+
 _VC_DIR = os.path.dirname(os.path.abspath(__file__))
 
 CLIPS_FOLDER = os.path.join(_VC_DIR, '..', 'resources', 'clips')
 
-SLACK_BOT_API_KEY = 'xoxb-124589937168-ljmRwQODWQ2R1d7eIs99hAc1'
+SLACK_BOT_API_KEY = None # 'xoxb-124589937168-ljmRwQODWQ2R1d7eIs99hAc1'
+
+MUSIC_FOLDER = '/mnt/nas/music/albums'
+
+
+ENABLE_SPEECH_INPUT = False
+
+ENABLE_SOUND_OUTPUT = False
 
-MUSIC_FOLDER = '/mnt/nas/music/albums'

+ 6 - 2
voice_control/input_sources/__init__.py

@@ -3,6 +3,7 @@ import threading
 import console
 import google_cloud_speech
 import slack_bot
+import conf
 
 LANGUAGE = 'en-GB'
 PREFERRED_PHRASES = None
@@ -32,10 +33,13 @@ def launch_input_sources():
 
     services = [
         console.ConsoleInput(_TOKEN_STREAM),
-        #google_cloud_speech.GoogleCloudSpeech(_TOKEN_STREAM),
-        slack_bot.SlackBot(_TOKEN_STREAM),
     ]
 
+    if conf.ENABLE_SPEECH_INPUT:
+        services.append(google_cloud_speech.GoogleCloudSpeech(_TOKEN_STREAM))
+    if conf.SLACK_BOT_API_KEY:
+        services.append(slack_bot.SlackBot(_TOKEN_STREAM))
+
     for s in services:
         t = threading.Thread(target=s.run)
         t.setDaemon(True)

+ 6 - 2
voice_control/output/__init__.py

@@ -2,13 +2,17 @@ import logging
 import audio_output
 import console
 import slack_bot
+import conf
 
 SERVICES = [
-    #audio_output.AudioOutput(),
     console.Console(),
-    slack_bot.SlackBot(),
 ]
 
+if conf.ENABLE_SOUND_OUTPUT:
+    SERVICES.append(audio_output.AudioOutput())
+if conf.SLACK_BOT_API_KEY:
+    SERVICES.append(slack_bot.SlackBot())
+
 def success():
     for service in SERVICES:
         service.success()