Skip to content

Commit

Permalink
completed the bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
privacyrespected committed Jan 19, 2022
1 parent a4ad401 commit 81d3654
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 8 deletions.
27 changes: 27 additions & 0 deletions alpha_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
print("[email protected]")

#import modules for chatterbot
from threading import Thread
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
Expand Down Expand Up @@ -69,3 +70,29 @@ def trainchatbot(trainer): #works in tandem with bootnoise.startupnoise1()
trainer.train(conversation8)
trainer.train(conversation9)






#working path starts here (listed here for checklist)
# 1. check user data
# 2. train NLP data ++ play boot sound 1
# 3. start frontend
# 4. time sleep 1 then start bootmessage
# 5. start the rest of the program


#general framework
# 1. check user data
checkuserdata()
# 2. train NLP data ++ play boot sound 1
try:
Thread(target=trainchatbot(trainer)).start()
Thread(target=startnoise1()).start()
except Exception as e:
notify("OHNO", e ,90)
print(e)
# 3. start frontend
# 4. time sleep 1 then start bootmessage
# 5. start the ALPHAMAIN
22 changes: 22 additions & 0 deletions data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"main_user_data": {
"dictpref": "british",
"userbloodtype": "null",
"usercity": "Newport",
"userdob": "1997-03-14",
"useremail": "[email protected]",
"useremailpass": "test123!!",
"userethnicity": "null",
"usergender": "Male",
"userheight": "null",
"userhobby": "null",
"userinterest": "null",
"username": "test",
"userpersonaldiscordbottoken": "null",
"userreligion": "null",
"userskincolor": "null",
"userspecies": "homo sapien",
"usersport": "null",
"userweight": "null"
}
}
Binary file not shown.
Binary file added modules/__pycache__/boot_message.cpython-36.pyc
Binary file not shown.
Binary file added modules/__pycache__/boot_noise.cpython-36.pyc
Binary file not shown.
Binary file added modules/__pycache__/sense.cpython-36.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion modules/boot_checkuserdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def checkuserdata():
#this file checks for user data
if path.isfile('data.json') == False:
notify("OPPs!","Cant start without data.json, try again","60")
notify("OPPs!","Cant start without data.json, try again",60)
time.sleep(30)
exit()
else:
Expand Down
23 changes: 23 additions & 0 deletions modules/boot_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from sys import modules
from threading import Thread
from boot_noise import *
from boot_message import *
from boot_checkuserdata import checkuserdata
from sense import notify
import random
def startup():
user_name=checkuserdata()[0]
user_gender=checkuserdata()[2]
random_functions = random.randint(1,2)
if int(random_functions) == 1:
wishMe(user_gender)
elif int(random_functions) == 2:
wishme2(user_name)
def bootloader(): #only this is meant to be called
try:
Thread(target=startupnoise).start()
Thread(target=startupnoise2).start()
Thread(target=startup()).start()
except Exception as e:
print(e)
notify("OHNO", e, 90)
3 changes: 2 additions & 1 deletion modules/boot_noise.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import playsound

import time
def startnoise1(): #this starts when training happens
time.sleep(2)
try:
playsound("audio/start2.mp3")
except Exception as e:
Expand Down
7 changes: 4 additions & 3 deletions modules/sense.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def listen():
return query

def notify(title, content, duration):
dataconfirm = ToastNotifier()
icon_path="app.ico"
dataconfirm.show_toast(title, content, duration, icon_path)
notify= ToastNotifier()
icon_path=None
notify.show_toast(title, content, icon_path, duration)


6 changes: 3 additions & 3 deletions usersetting/usersettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
from modules.sense import speak
#imports the notification system.
from win10toast import ToastNotifier

Expand Down Expand Up @@ -52,11 +53,10 @@ def usersettingwrite(username, usercity, user_gender, userdob, useremail, userem
"dictpref":"british"
}
}
speak("Please wait while we load your data")
json.dump(data, f, ensure_ascii=False, sort_keys=True, indent=4)
#notifies the user that
dataconfirm = ToastNotifier()
dataconfirm.show_toast("Alpha", "User data confirmed.", duration = 20, icon_path ="app.ico")
time.sleep(5)
speak("Data loaded and confirmed")
exit()
except Exception as e:
print(e)
Expand Down

0 comments on commit 81d3654

Please sign in to comment.