forked from xhunmon/PythonIsTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtran_test.py
More file actions
35 lines (28 loc) · 664 Bytes
/
tran_test.py
File metadata and controls
35 lines (28 loc) · 664 Bytes
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
#!/usr/bin/python3.9
# -*- coding: utf-8 -*-
"""
@Time : 2023/5/18 14:38
@Author : xhunmon
@Email : [email protected]
@File : tran_test.py
@Desc :
"""
import re
from load_srt import Translator
import time
from utils import *
def t_test(srt_source):
sub_start = '00:02:00'
v_start = '00:00:17'
def translate_callback(status, **kwargs):
print(status)
print(kwargs["src"])
print(kwargs["dst"])
print(kwargs["msg"])
if __name__ == '__main__':
tl = Translator()
tl.add_callback(translate_callback)
try:
tl.translate_file("output/test.srt", "output/test_out.srt")
except Exception as e:
print(e)