-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
executable file
·78 lines (68 loc) · 3.94 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
from os.path import exists, join
from os import makedirs, system
import logging
import traceback
from src.gui import SpeechDetectionGUI
title = """
_____ _
/ ____| | |
| (___ _ __ ___ ___ ___ | |__
\___ \ | '_ \ / _ \ / _ \ / __| | '_ \
____) | | |_) | | __/ | __/ | (__ | | | |
|_____/ | .__/ \___| _\___| \___| |_| |_| _
/\ | | (_) | | | |
/ \ _|_| ___ _ | |_ __ _ _ __ | |_
/ /\ \ / __| / __| | | | __| / _` | | '_ \ | __|
/ ____ \ \__ \ \__ \ | | | |_ | (_| | | | | | | |_
/_/ \_\ |___/ |___/ |_| \__| \__,_| |_| |_| \__|
"""
title2 = """
Welcome to
░██████╗██████╗░███████╗███████╗░█████╗░██╗░░██╗
██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗██║░░██║
╚█████╗░██████╔╝█████╗░░█████╗░░██║░░╚═╝███████║
░╚═══██╗██╔═══╝░██╔══╝░░██╔══╝░░██║░░██╗██╔══██║
██████╔╝██║░░░░░███████╗███████╗╚█████╔╝██║░░██║
╚═════╝░╚═╝░░░░░╚══════╝╚══════╝░╚════╝░╚═╝░░╚═╝
░█████╗░░██████╗░██████╗██╗████████╗░█████╗░███╗░░██╗████████╗
██╔══██╗██╔════╝██╔════╝██║╚══██╔══╝██╔══██╗████╗░██║╚══██╔══╝
███████║╚█████╗░╚█████╗░██║░░░██║░░░███████║██╔██╗██║░░░██║░░░
██╔══██║░╚═══██╗░╚═══██╗██║░░░██║░░░██╔══██║██║╚████║░░░██║░░░
██║░░██║██████╔╝██████╔╝██║░░░██║░░░██║░░██║██║░╚███║░░░██║░░░
╚═╝░░╚═╝╚═════╝░╚═════╝░╚═╝░░░╚═╝░░░╚═╝░░╚═╝╚═╝░░╚══╝░░░╚═╝░░░
"""
if __name__ == "__main__":
# Welcome message
print(title2)
del title, title2
system("") # Enable ANSI colors
print(
"Hold \033[37;42m Hotkey \033[0m for dictation or "
+ "Press \033[37;41m Ctrl + c \033[0m to end the program."
)
print("--------------------------------------------------------------------")
# Creates logs directory if it doesn't exist
if not exists("logs"):
makedirs("logs")
# Configure the logging settings
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
filename=join("logs", "speech-assistant.log"),
filemode="w",
)
logger = logging.getLogger(__name__)
logger.info("Program started")
try:
gui = SpeechDetectionGUI()
gui.run()
print("GUI closed")
except KeyboardInterrupt:
pass
except Exception as e:
logger.error(f"Exception hit: {traceback.format_exc()}\n{e}")
pass
finally:
print("\n\n\033[30;47m Thank you for using speech-assistant! \033[0m")
logger.info("Exited main.py")