File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
temp = './temp/'
8
8
9
+ print ('Google TTS version 1.0 by ReekyStive' )
10
+ print ('Type ":quit" to quit, type ":proxy" to set proxy.' )
11
+ print ('Type anything to start.' )
9
12
10
13
while (True ):
11
14
s = input ('> ' )
15
+ if s .strip () == ':quit' :
16
+ break
17
+ elif s .strip () == ':proxy' :
18
+ server = input ('HTTP Proxy server: ' )
19
+ os .environ ['http_proxy' ] = server
20
+ os .environ ['https_proxy' ] = server
21
+ print ('Proxy is set.\n ' )
22
+ continue
12
23
13
24
print ('Generating...' , end = '' )
14
25
sys .stdout .flush ()
15
26
try :
16
27
os .remove (temp + 'speech.mp3' )
17
28
except :
18
29
pass
19
- tts = gtts (s )
20
- tts .save (temp + 'speech.mp3' )
30
+ try :
31
+ tts = gtts (s )
32
+ tts .save (temp + 'speech.mp3' )
33
+ except AssertionError :
34
+ print (' Nothing to generate.\n ' )
35
+ continue
36
+ except :
37
+ print (' Failed.' )
38
+ print ('Please check your connection with Google.' )
39
+ print ('Enter ":proxy" to set proxy.\n ' )
40
+ continue
21
41
22
42
print (' Decoding...' , end = '' )
23
43
sys .stdout .flush ()
You can’t perform that action at this time.
0 commit comments