-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (45 loc) · 1.62 KB
/
main.py
File metadata and controls
50 lines (45 loc) · 1.62 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
import argparse
import sys
import GUI
def getInput():
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('videoTypeStr', type=str, help='视频类型,可接受的参数: flag wsw',choices=['flag', 'wsw'])
parser.add_argument('openPath', type=str, help='输入视频文件路径')
parser.add_argument('-o', type=str, default=None, required=False, help='输出字幕文件路径,默认输出为视频目录下同名ass文件')
parser.add_argument(
"-s",
type=int,
default=2,
required=False,
help="flag系列OP类型,可接受:0=远古OP,1=旧OP,2=新OP-长,3=新OP-短,默认为2",
choices=[0, 1, 2, 3],
)
args = parser.parse_args()
videoTypeStr = args.videoTypeStr
opType = args.s
openPath = args.openPath
savePath = args.o
savePath = (
str(openPath).rstrip(str(openPath).split(".")[-1]) + "ass"
if savePath is None
else savePath
)
videoType = 0 if videoTypeStr == 'flag' else 1 if videoTypeStr == 'wsw' else exit()
return openPath, savePath, videoType, opType
def main():
if(len(sys.argv) > 1):
print("当前为命令行模式")
print('开始打轴...')
inputList = getInput()
else:
print("当前为GUI模式")
print("正在呼起GUI...")
inputList = GUI.runGUI()
if(inputList[2]==0):
from flag import autosub
autosub(inputList[0],inputList[1],inputList[3])
elif(inputList[2]==1):
from wsw import autosub
autosub(inputList[0],inputList[1])
if __name__ == '__main__':
main()