diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-05-27 19:02:15 -0700 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-05-27 19:02:15 -0700 |
| commit | 6564ee46c48cccd9d8947fea2fa570389f1646e9 (patch) | |
| tree | 646aec89cb9a90dfe6df853fc601d3c087d7c069 /boot/boot.py | |
| parent | 0e1762970b4c3cc938012d7644b70ec5e8ccf947 (diff) | |
| parent | 38258b6033869da653e6568195c5c870cbf4ddd5 (diff) | |
| download | jasper-client-6564ee46c48cccd9d8947fea2fa570389f1646e9.tar.gz jasper-client-6564ee46c48cccd9d8947fea2fa570389f1646e9.zip | |
Merge branch 'master' of https://github.com/jasperproject/jasper-client
Diffstat (limited to 'boot/boot.py')
| -rwxr-xr-x | boot/boot.py | 62 |
1 files changed, 5 insertions, 57 deletions
diff --git a/boot/boot.py b/boot/boot.py index b33fd34..ebe6b35 100755 --- a/boot/boot.py +++ b/boot/boot.py @@ -3,21 +3,15 @@ import os, json import urllib2 import yaml -from wifi import * import vocabcompiler def say(phrase, OPTIONS = " -vdefault+m3 -p 40 -s 160 --stdout > say.wav"): - os.system("espeak " + json.dumps(phrase) + OPTIONS) os.system("aplay -D hw:1,0 say.wav") - - -# check if there is network connection def configure(): try: - urllib2.urlopen("http://www.google.com").getcode() print "CONNECTED TO INTERNET" @@ -25,58 +19,12 @@ def configure(): vocabcompiler.compile("../client/sentences.txt", "../client/dictionary.dic", "../client/languagemodel.lm") print "STARTING CLIENT PROGRAM" - - try: - os.system("/home/pi/jasper/client/start.sh &") - except: - os.system("/home/pi/jasper/backup/start.sh &") - finally: - return - + os.system("/home/pi/jasper/client/start.sh &") + except: - - networks = yaml.safe_load(open("networks.yml", "r")) - - wifi = Wifi() - - for network in networks: - wifi.set_default_wifi(network['SSID'], network['KEY']) - say("Attempting to connect to network " + network['SSID']) - - try: - - urllib2.urlopen("http://www.google.com").getcode() - - print "CONNECTED TO INTERNET" - print "COMPILING DICTIONARY" - vocabcompiler.compile("../client/sentences.txt", "../client/dictionary.dic", "../client/languagemodel.lm") - - print "STARTING CLIENT PROGRAM" - - try: - os.system("/home/pi/jasper/client/start.sh &") - except: - os.system("/home/pi/jasper/backup/start.sh &") - finally: - return - - except: - pass - - print "NOT CONNECTED TO INTERNET. RUNNING AD HOC NETWORK." - - wifi.setup_adhoc() - - os.system("sudo app/app.sh &") - say("Hello.... I could not connect to a wifi network... Please log in with your computer to help me") - - original = open("networks.yml",'r').readlines() - while True: - list = open("networks.yml",'r').readlines() - if list != original: - break - - say("Thank you for adding a wifi network. Just give me a few minutes to restart.") + + print "COULD NOT CONNECT TO NETWORK" + say("Hello, I could not connect to a network. Please read the documentation to configure your Raspberry Pi.") os.system("sudo shutdown -r now") if __name__ == "__main__": |
