def __init__(self): """ First it looks for and initializes APIs in the "api_library" folder. Then it prompts the user to log in. Next it verifies that the user's .yml file is configured for each API. If an API's required configuration variables are not found, the API is disabled. Next it finds and loads modules in the "modules" folder. Lastly, it initializes the STT engine. Use "from athena.apis import api_lib" & "api_lib['(api_name_key)']" to access instances of APIs. """ apis.find_apis() self.login() apis.verify_apis(self.user) apis.list_apis() self.find_mods() self.list_mods() self.greet() stt.init() self.quit_flag = False
""" A simple test script for passive/active listening """ import traceback from athena import settings print('---- Running Microphone Test ----') try: print('\n~ Importing stt.py...') import athena.stt as stt print('~ Initializing stt.py...') stt.init() text = '' while 'q' not in text.lower(): print('\n~ Type \'q\' at any time to quit') text = input('~ Test Active or Passive Listening? (A/P): ') if 'p' in text.lower(): print('\n~ Wake Up Word: \''+settings.WAKE_UP_WORD+'\'') stt.listen_keyword() print('~ Wake Up Word Detected!') elif 'a' in text.lower(): stt.active_listen() print('\nMicrophone Test PASSED! :)\n') except Exception as e: print(traceback.format_exc()) if 'invalid input device' in str(e).lower(): print('\n~ PyAudio could not detect a microphone!')