import os
import time
import sys
from agentspace import Agent, space
from lips import LipsAgent

def quit():
    os._exit(0)

def speak(text):
    os.environ["ESPEAK_DATA_PATH"] = "." 
    os.system('espeak -z "'+text+'"')

if __name__ == "__main__":  
    LipsAgent('speaking')
    text = sys.argv[1] if len(sys.argv) > 1 else "eee"
    space['speaking'] = True
    print('speaking started')
    speak(text)
    print('speaking finished')
    space['speaking'] = False
    time.sleep(0.5)
    quit()
