forked from metafy-social/python-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
61 lines (58 loc) · 1.56 KB
/
script.py
File metadata and controls
61 lines (58 loc) · 1.56 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
from gtts import gTTS
from playsound import playsound
import os
mytext = input("Enter text: ")
print("MENU\n1. English (Australia)\n2. English (United Kingdom)\n3. English (United States)\n4. English (Canada)\n5. English (India)\n6. English (Ireland)\n7. English (South Africa)\n8. French (Canada)\n9. French (France)\n10. Mandarin (China Mainland)\n11. Mandarin (Taiwan)\n12. Portuguese (Brazil)\n13. Portuguese (Portugal)\n14. Spanish (Mexico)\n15. Spanish (Spain)\n16. Spanish (United States)")
option = int(input("Select option: "))
if option == 1:
language = 'en'
tld1 = 'com.au'
if option == 2:
language = 'en'
tld1 = 'co.uk'
if option == 3:
language = 'en'
tld1 = 'com'
if option == 4:
language = 'en'
tld1 = 'ca'
if option == 5:
language = 'en'
tld1 = 'co.in'
if option == 6:
language = 'en'
tld1 = 'ie'
if option == 7:
language = 'en'
tld1 = 'co.za'
if option == 8:
language = 'fr'
tld1 = 'ca'
if option == 9:
language = 'fr'
tld1 = 'fr'
if option == 10:
language = 'zh-CN'
tld1 = 'com'
if option == 11:
language = 'zh-TW'
tld1 = 'com'
if option == 12:
language = 'pt'
tld1 = 'com.br'
if option == 13:
language = 'pt'
tld1 = 'pt'
if option == 14:
language = 'es'
tld1 = 'com.mx'
if option == 15:
language = 'es'
tld1 = 'es'
if option == 16:
language = 'es'
tld1 = 'com'
tts = gTTS(text=mytext, tld=tld1, lang=language, slow=False)
audio_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tts.mp3")
tts.save(audio_file)
playsound(audio_file)