summaryrefslogtreecommitdiff
path: root/jasper.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-07 19:32:42 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-07 19:32:42 +0200
commit7e6e87cf45831e53fd0b1bcc73315068738402f6 (patch)
tree6c6a5e30b7254dd82a25d2d8a0f3f4c6c7cc7fe5 /jasper.py
parent016cc20ad8605371e820e509f9881c2750019d09 (diff)
parent68704f36d7c05e06ffdf65e2593aa296ffd3a64d (diff)
downloadjasper-client-7e6e87cf45831e53fd0b1bcc73315068738402f6.tar.gz
jasper-client-7e6e87cf45831e53fd0b1bcc73315068738402f6.zip
Merge pull request #210 from Holzhaus/diagnose-improvements
Diagnose improvements
Diffstat (limited to 'jasper.py')
-rwxr-xr-xjasper.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/jasper.py b/jasper.py
index 27a8de8..d116ce9 100755
--- a/jasper.py
+++ b/jasper.py
@@ -8,8 +8,7 @@ import logging
import yaml
import argparse
-from client.diagnose import Diagnostics
-from client import vocabcompiler, tts, stt, jasperpath
+from client import vocabcompiler, tts, stt, jasperpath, diagnose
# Add jasperpath.LIB_PATH to sys.path
sys.path.append(jasperpath.LIB_PATH)
@@ -21,6 +20,8 @@ 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')
+parser.add_argument('--diagnose', action='store_true',
+ help='Run diagnose and exit')
parser.add_argument('--debug', action='store_true', help='Show debug messages')
args = parser.parse_args()
@@ -132,11 +133,14 @@ if __name__ == "__main__":
if args.debug:
logger.setLevel(logging.DEBUG)
- if (not args.no_network_check and
- not Diagnostics.check_network_connection()):
+ if not args.no_network_check and not diagnose.check_network_connection():
logger.warning("Network not connected. This may prevent Jasper from " +
"running properly.")
+ if args.diagnose:
+ failed_checks = diagnose.run()
+ sys.exit(0 if not failed_checks else 1)
+
try:
app = Jasper()
except Exception: