-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.py
More file actions
70 lines (57 loc) · 1.43 KB
/
process.py
File metadata and controls
70 lines (57 loc) · 1.43 KB
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
import os
from gtts import gTTS
import multiprocessing
try:
f = open("Process\\connect_check","r")
f.close()
conect_check_run = True
os.remove("Process\\connect_check")
except:
conect_check_run = False
try:
f = open("Process\\play","r")
f.close()
play_run = True
os.remove("Process\\play")
except:
play_run = False
def play():
file = open("Process\\text","r")
text = file.read()
file.close()
file = open("Process\\name","r")
num = file.readline()
file.close()
try:
audio = gTTS(text)
audio.save("Process\\audio"+num+".mp3")
f = open("Process\\get","w")
f.close()
except:
f = open("Process\\get_error","w")
f.close()
def connect_check():
try:
os.remove("Process\\connect.mp3")
except :
pass
text = "connection"
try:
audio = gTTS(text)
audio.save("Process\\connect.mp3")
audio_created_completed = True
except:
audio_created_completed = False
if audio_created_completed == True:
f = open("Process\\conect","w")
f.close()
else:
f = open("Process\\conecterror","w")
f.close()
if __name__ == '__main__':
process1 = multiprocessing.Process(target=play)
process2 = multiprocessing.Process(target=connect_check)
if play_run == True:
process1.run()
if conect_check_run == True :
process2.run()