-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
signals.py
117 lines (93 loc) · 2.84 KB
/
signals.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import queue
class Signals:
def __init__(self):
self._human_speaking = False
self._AI_speaking = False
self._AI_thinking = False
self._last_message_time = 0.0
self._new_message = False
self._tts_ready = False
self._stt_ready = False
self._recentTwitchMessages = []
self._history = []
# This flag indicates to all threads that they should immediately terminate
self._terminate = False
self.sio_queue = queue.SimpleQueue()
@property
def human_speaking(self):
return self._human_speaking
@human_speaking.setter
def human_speaking(self, value):
self._human_speaking = value
self.sio_queue.put(('human_speaking', value))
if value:
print("SIGNALS: Human Talking Start")
else:
print("SIGNALS: Human Talking Stop")
@property
def AI_speaking(self):
return self._AI_speaking
@AI_speaking.setter
def AI_speaking(self, value):
self._AI_speaking = value
self.sio_queue.put(('AI_speaking', value))
if value:
print("SIGNALS: AI Talking Start")
else:
print("SIGNALS: AI Talking Stop")
@property
def AI_thinking(self):
return self._AI_thinking
@AI_thinking.setter
def AI_thinking(self, value):
self._AI_thinking = value
self.sio_queue.put(('AI_thinking', value))
if value:
print("SIGNALS: AI Thinking Start")
else:
print("SIGNALS: AI Thinking Stop")
@property
def last_message_time(self):
return self._last_message_time
@last_message_time.setter
def last_message_time(self, value):
self._last_message_time = value
@property
def new_message(self):
return self._new_message
@new_message.setter
def new_message(self, value):
self._new_message = value
if value:
print("SIGNALS: New Message")
@property
def tts_ready(self):
return self._tts_ready
@tts_ready.setter
def tts_ready(self, value):
self._tts_ready = value
@property
def stt_ready(self):
return self._stt_ready
@stt_ready.setter
def stt_ready(self, value):
self._stt_ready = value
@property
def recentTwitchMessages(self):
return self._recentTwitchMessages
@recentTwitchMessages.setter
def recentTwitchMessages(self, value):
self._recentTwitchMessages = value
self.sio_queue.put(('recent_twitch_messages', value))
@property
def history(self):
return self._history
@history.setter
def history(self, value):
self._history = value
@property
def terminate(self):
return self._terminate
@terminate.setter
def terminate(self, value):
self._terminate = value