diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-12 19:46:27 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-12 19:46:27 +0200 |
| commit | 0ebdd82b4fba0fa59dba25b6c68c295726e224a8 (patch) | |
| tree | 43c7f82c31e91cb18c3e409ec6df5c50412d8c7b | |
| parent | 013d42ca921432ac5513d9c9b2427b3ffe0bb8a0 (diff) | |
| download | jasper-client-0ebdd82b4fba0fa59dba25b6c68c295726e224a8.tar.gz jasper-client-0ebdd82b4fba0fa59dba25b6c68c295726e224a8.zip | |
Using argparse module
| -rwxr-xr-x | jasper.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -4,6 +4,7 @@ import sys import traceback import shutil import yaml +import argparse # Set $JASPER_HOME jasper_home = os.getenv("JASPER_HOME") @@ -19,7 +20,13 @@ from client.diagnose import Diagnostics from client import vocabcompiler, stt from client import speaker as speak from client.conversation import Conversation -if len(sys.argv) > 1 and "--local" in sys.argv[1:]: + +parser = argparse.ArgumentParser(description='Test suite for the Jasper client code.') +parser.add_argument('--local', action='store_true', help='Use text input instead of a real microphone') +parser.add_argument('--no-network-check', action='store_true', help='Disable the network connection check') +args = parser.parse_args() + +if args.local: from client.local_mic import Mic else: from client.mic import Mic @@ -92,8 +99,10 @@ if __name__ == "__main__": print " Copyright 2013 Shubhro Saha & Charlie Marsh " print "===========================================================" + speaker.say("Hello.... I am Jasper... Please wait one moment.") - testConnection() + if not args.no_network_check: + testConnection() configure() profile = yaml.safe_load(open("profile.yml", "r")) |
