-
Notifications
You must be signed in to change notification settings - Fork 1
/
__main__.py
137 lines (124 loc) · 7.93 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import os, googletrans
from sys import argv
import translec as tr
from time import sleep
def main2():
# -*- Color in your shell
os.system('''
white="\033[1;37m"
grey="\033[0;37m"
purple="\033[0;35m"
red="\033[1;31m"
green="\033[1;32m"
yellow="\033[1;33m"
purple="\033[0;35m"
cyan="\033[0;36m"
cafe="\033[0;33m"
fiuscha="\033[0;35m"
blue="\033[1;34m"
nc="\e[0m"
printf "$green
╔═══════════════════════════════════════════════════════════════════════════════╗
════╝
████████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ ███████╗ ██████╗
╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ ██╔════╝██╔════╝
██║ ██████╔╝███████║██╔██╗ ██║███████╗██║ █████╗ ██║
██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║ ██╔══╝ ██║
██║ ██║ ██║██║ ██║██║ ╚████║███████║███████╗███████╗╚██████╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝╚══════╝ ╚═════╝
╔═══════════════════════════════════════════════════════════════════════════════╗
════╝"
''')
def main():
# -*- Color in your shell
os.system('''
white="\033[1;37m"
grey="\033[0;37m"
purple="\033[0;35m"
red="\033[1;31m"
green="\033[1;32m"
yellow="\033[1;33m"
purple="\033[0;35m"
cyan="\033[0;36m"
cafe="\033[0;33m"
fiuscha="\033[0;35m"
blue="\033[1;34m"
nc="\e[0m"
printf "$green
╔═══════════════════════════════════════════════════════════════════════════════╗
════╝
████████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ ███████╗ ██████╗
╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ ██╔════╝██╔════╝
██║ ██████╔╝███████║██╔██╗ ██║███████╗██║ █████╗ ██║
██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║ ██╔══╝ ██║
██║ ██║ ██║██║ ██║██║ ╚████║███████║███████╗███████╗╚██████╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝╚══════╝ ╚═════╝
╔═══════════════════════════════════════════════════════════════════════════════╗
════╝
╔══════════════════════════╗╔═══════════════════════════════════════════════════╗
║ ${yellow}⟫${red}⟫${white}⟫${green} Usage ║║ ${yellow}⟫${red}⟫${white}⟫${green} Information ║
║ ║║ ║
║ [+] --help | -h ║║ [ List All Information ] ║
║ [+] --descript | -d ║║ [ Set the output language ] ║
║ [+] --all ║║ [ Translate all files ] ║
║ [+] -l ║║ [ Listar todos os arquivos (str/vtt) ] ║
║ [+] -f ║║ [ Choose a text file ] ║
╚══════════════════════════╝╚═══════════════════════════════════════════════════╝
════╗
╚═══════════════════════════════════════════════════════════════════════════════╝
"
''')
def _exec():
main()
try:
# -*- -l -*-
if(ls):
os.system("clear")
main2()
tr.Path()
tr.Path.printlist()
# -*- --Descript -*-
if(("--descript" in query) and ("--all" in query)):
tr.Path()
for file in tr.files:
tr.Trans(file, query["--descript"])
# -*- --all -*-
if(("--all" not in query) and ("--descript" in query)):
while True:
phrase = str(input("Enter the phrase: "))
if(phrase == "exit"):
print("Bay, Bay ...")
sleep(.5)
break
transp = tr.Transp(phrase, query["--descript"])
except:
os.system('''
red="\033[1;31m"
printf "\n$red[!]$red Aconteceu um erro não Programavel $red[!]\nPor favor acesse: https://github.com/anastaciopaulino/TransLec\n"''')
sleep(.5)
else:
pass
ls = False
command = argv[1:]
count = 0
ftxt = False
query = {}
for instrucion in command:
if ("--descript" in instrucion) or ("-d" in instrucion):
try:
out = command[count+1]
query["--descript"] = out
except IndexError:
print("Value for '--descript'")
if ("-l" in instrucion):
ls = True
if("--all" in instrucion):
query["--all"] = True
if ("-f" in instrucion):
try:
ftxt = command[count+1]
query["-f"] = ftxt
except IndexError:
print("Value for '-f'")
count += 1
_exec()