Skip to content

Commit ea7bf63

Browse files
author
Calvin Xu
committed
Minor Update
Dirty fix, so that it supports more video formats, in theory.
1 parent 02496bb commit ea7bf63

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ build/
66

77
.tox/
88
.coverage
9+
*.xml
10+
*.iml

mach3/mkv_interface.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44

55
def mkv_play(fileName, start, end):
66
sub_name = fileName
7-
vid_name = sub_name[:-4] + ".mkv"
7+
vid_name = sub_name[:-4]
88

9-
command = "mpv --window-scale=0.5 --pause --keep-open=yes --start={} --end={} --sub-file={} {}"\
10-
.format(quote(start), quote(end), quote(sub_name), quote(vid_name))
9+
if os.path.exists(vid_name + ".mkv"):
10+
command = "mpv --window-scale=0.5 --pause --keep-open=yes --start={} --end={} --sub-file={} {}"\
11+
.format(quote(start), quote(end), quote(sub_name), quote(vid_name + ".mkv"))
12+
elif os.path.exists(vid_name + ".mp4"):
13+
command = "mpv --window-scale=0.5 --pause --keep-open=yes --start={} --end={} --sub-file={} {}"\
14+
.format(quote(start), quote(end), quote(sub_name), quote(vid_name + ".mp4"))
15+
elif os.path.exists(vid_name + ".mov"):
16+
command = "mpv --window-scale=0.5 --pause --keep-open=yes --start={} --end={} --sub-file={} {}"\
17+
.format(quote(start), quote(end), quote(sub_name), quote(vid_name + ".mov"))
18+
else:
19+
print("I cannot find the matching video file for you, Misaka tries and fails. \nPlease make sure they have the same file name.")
20+
exit(1)
1121

22+
print(command)
1223
os.system(command)

mach3/subtitle_parse.py

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def regex_process(text):
2424

2525
def get_dialogues(file_name):
2626
with open(file_name, "r") as rawFile:
27+
print(file_name)
2728
doc = ass.parse(rawFile)
2829
dialogues = []
2930
for event in doc.events:

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='mach3',
8-
version='0.1.1.0.4',
8+
version='0.2.2',
99
url='https://github.com/Calvin-Xu/mach3-cli',
1010
download_url = 'https://github.com/Calvin-Xu/mach3-cli/archive/0.1.tar.gz',
1111
license='MIT',

0 commit comments

Comments
 (0)