forked from Echoosx/AutoSubtitle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
58 lines (52 loc) · 2.2 KB
/
main.py
File metadata and controls
58 lines (52 loc) · 2.2 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
import GUI
import argparse
import sys
from config import configInit, getGlobalConfig, setGlobalConfig
import ctypes
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=str, default='new', required=False, help='flag系列OP类型,可接受:old、new,默认为new',
choices=['old', 'new'])
args = parser.parse_args()
videoTypeStr = args.videoTypeStr
videoSeries = args.s
openPath = args.openPath
savePath = args.o
savePath = str(openPath).rstrip(str(openPath).split('.')[-1]) + "ass" if savePath is None else savePath
newOP = True if videoSeries == 'new' else False if args.s == 'old' else exit()
videoType = 0 if videoTypeStr == 'flag' else 1 if videoTypeStr == 'wsw' else exit()
return openPath, savePath, videoType, newOP
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])
elif inputList[2] == 2:
from hundrednote_white import autosub
autosub(inputList[0], inputList[1])
elif inputList[2] == 3:
from hundrednote_color import autosub
autosub(inputList[0], inputList[1])
elif inputList[2] == 4:
from hundrednote_game import autosub
autosub(inputList[0], inputList[1])
elif inputList[2] == 5:
from parako import autosub
autosub(inputList[0], inputList[1])
if __name__ == '__main__':
configInit()
main()