Skip to content
This repository was archived by the owner on Apr 18, 2023. It is now read-only.

Commit 6003a61

Browse files
authored
Merge pull request #2 from FarisR99/release-1.0.1
Release 1.0.1
2 parents f1acddf + c177b2f commit 6003a61

4 files changed

Lines changed: 19 additions & 4 deletions

File tree

Anime4K.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@
8989

9090
# Validate "output" argument
9191
if mode == "audio" or mode == "subs":
92-
output = args['output'] or ""
92+
output = args['output']
93+
if output is None:
94+
output = ""
9395
if output != "":
9496
if not os.path.isdir(output):
9597
print("Output directory {0} does not exist".format(output))
@@ -99,6 +101,8 @@
99101
output = output + "/"
100102
elif mode == "mux" or mode == "shader":
101103
output = args['output'] or "out.mkv"
104+
elif mode == "split":
105+
output = args['output']
102106

103107
if mode == "audio":
104108
extract_audio(fn, output)
@@ -113,6 +117,6 @@
113117
elif mode == "split":
114118
length = get_video_length(fn)
115119
split_by_seconds(filename=fn, split_length=args['split_length'],
116-
video_length=length, split_dir=args['output'])
120+
video_length=length, split_dir=output)
117121
else:
118122
print("Unknown option: {0}".format(mode))

extract_subs.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def genExt(codec):
1212
return "ass"
1313
elif "SRT" in codec or "SubRip" in codec:
1414
return "srt"
15+
elif "VobSub" in codec:
16+
return "idx"
17+
else:
18+
return None
1519

1620

1721
def extract_subs(fn: str, out_dir: str):
@@ -34,9 +38,13 @@ def extract_subs(fn: str, out_dir: str):
3438
for track in tracks:
3539
if track.track_type == 'subtitles':
3640
ext = genExt(track._track_codec)
41+
if ext is None:
42+
print("WARNING: Skipping unknown subtitle with id={0}, codec={1}".format(str(track._track_id), str(track._track_codec or "Unknown")))
43+
continue
3744
lang = track._language
3845
id = str(track._track_id)
3946

4047
subprocess.call(['mkvextract', 'tracks', fn,
41-
id + ':' + out_dir + lang + '_' + id + '.' + ext])
48+
id + ':' + str(out_dir) + str(
49+
lang) + '_' + id + '.' + ext])
4250
print("Subtitle extraction end time: " + current_date())

mux.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def mux(fn: str, out: str):
8181
addSubs(mkv, "sup")
8282
addSubs(mkv, "srt")
8383
addSubs(mkv, "ass")
84+
addSubs(mkv, "idx")
8485

8586
print("Mux start time: " + current_date())
8687
mkv.mux(out)
@@ -101,4 +102,6 @@ def mux(fn: str, out: str):
101102
delete_by_extension("sup")
102103
delete_by_extension("srt")
103104
delete_by_extension("ass")
105+
delete_by_extension("idx")
106+
delete_by_extension("sub")
104107
print("Cleaned!")

utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime
33
from shutil import which
44

5-
__current_version__ = '1.0.0'
5+
__current_version__ = '1.0.1'
66

77

88
def credz():

0 commit comments

Comments
 (0)