def __init__(self): """Initalize 'speak' plugin.""" DaemonPlugin.__init__(self) # Open socket to festival server at port 1314 self.fest = festival.open() # We want non-blocking behavior self.fest.block(False) # Set welcome/shutdown messages if config.SPEAK_WELCOME: self.welcome_msg = config.SPEAK_WELCOME else: self.welcome_msg = _('Welcome to Freevo!') if config.SPEAK_SHUTDOWN: self.shutdown_msg = config.SPEAK_SHUTDOWN else: self.shutdown_msg = _('Good bye!') # Say hello self.speak(self.welcome_msg)
self.log.info(self.name+': '+digest) self.say(digest) else: message="ERROR: could not retrieve msg" self.log.warning(message) say(message) raise RuntimeError, "could not retrieve msg" conn.close() conn.logout() return self.lastid if __name__ == "__main__": import config import festival,os say = festival.open().say conf = config.config(os.path.expanduser('~/.alvi.cfg')) conf.load() params = conf.getConf('Mail') print params m = MailReader(params['mail_server'],'IMAP', True, params['username'], params['password'], params['lastid'], say ) lastid = m.read() print lastid
#import commands import festival import aiml k = aiml.Kernel() k.loadBrain("alice.brn") #k.learn("startup.xml") #k.respond("load aiml b") #commands.getoutput("espeak -k20 -s150 -ven+15 Hello User") while True: len0 = k.respond(raw_input("Me:>")) #len1="espeak -k20 -s150 -ven+10" #len0 = " \""+len0+"\"" #len2=len1+len0 #commands.getoutput(len2) festival.open().say(len0) print len0
#import commands import festival import aiml k=aiml.Kernel() k.loadBrain("alice.brn") #k.learn("startup.xml") #k.respond("load aiml b") #commands.getoutput("espeak -k20 -s150 -ven+15 Hello User") while True : len0=k.respond(raw_input("Me:>")) #len1="espeak -k20 -s150 -ven+10" #len0 = " \""+len0+"\"" #len2=len1+len0 #commands.getoutput(len2) festival.open().say(len0) print len0