Skip to content
This repository was archived by the owner on Jun 2, 2022. It is now read-only.

Commit 854ff12

Browse files
author
FRIPOUILLEJACK
committed
AnkoA v3.2.5 - Remux mode fix
Mkvextract all tracks before merge in case of multi tracks sources
1 parent deddb61 commit 854ff12

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

app/main/main.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
(folder, thumb, tag, team, announce, tmdb_api_key, tag_thumb) = option()
6262

6363

64-
def MUXING_MODE(encode_type, source, title, year, stag):
64+
def MUXING_MODE(encode_type, source, title, year, stag, folder):
6565

6666
# Set some values
6767
extend = ".mkv"
@@ -74,8 +74,8 @@ def MUXING_MODE(encode_type, source, title, year, stag):
7474

7575
# Audio infos
7676
audiotype = ask_audio_type()
77-
(audio_config, audiocodec, lang,
78-
audiolang) = AUDIO_CONFIGURATION(audiotype, encode_type)
77+
(audio_config, audiocodec, lang, audiolang, audionum,
78+
audionum2) = AUDIO_CONFIGURATION(audiotype, encode_type)
7979
xcod_val = ["x264", "x265"]
8080
xcod2_val = ["AC3", "DTS", "AAC"]
8181
for item in xcod_val:
@@ -112,16 +112,30 @@ def MUXING_MODE(encode_type, source, title, year, stag):
112112
nfoimdb = ask_rls_imdb()
113113
(name, nfoimdb) = find_release_title(nfoimdb)
114114

115+
# Mkvextract Tracks
116+
idvid = "{0}:{0}".format(idvideo)
117+
[audio_1, audio_2] = ["", ] * 2
118+
if audionum:
119+
audio_1 = " {0}:{0}".format(audionum)
120+
if audionum2:
121+
audio_2 = " {0}:{0}".format(audionum2)
122+
mkvextract = "cd {0} && mkdir tmp_mkv && cd tmp_mkv && mkvextract tracks"\
123+
" {1} {2}{3}{4} && mkvmerge -o {5}.{6}{7}{8} {10} {11} {12}"\
124+
" && mv {5}.{6}{7}{8} {9} && cd .. && rm -r tmp_mkv"\
125+
.format(thumb, source, idvid, audio_1, audio_2, title, year,
126+
stag, mark, folder, idvideo, audionum, audionum2)
127+
source_mkv = "{0}{1}.{2}{3}{4}".format(folder, title, year, stag, mark)
128+
115129
# Final remux cmds
116130
mkvmerge = MKVMERGE(subtype, audiotype, thumb, title, year, stag, mark,
117131
extend, sync, titlesub, charset, idsub, forced, sync2,
118132
titlesub2, charset2, idsub2, subsource)
119133
temp = "{0}{1}{2}".format(thumb, title, extend)
120-
mkvmerge = mkvmerge.split('&&', 2)[1].strip().replace(temp, source)
134+
mkvmerge = mkvmerge.split('&&', 2)[1].strip().replace(temp, source_mkv)
121135
tools = ankoa_tools(thumb, title, year, stag, mark, audiolang, prezquality,
122136
titlesub, subforced, nfosource, nfoimdb, name)
123137

124-
return (mkvmerge, tools)
138+
return (mkvmerge, mkvextract, tools)
125139

126140

127141
def AUDIO_CONFIGURATION(audiotype, encode_type):
@@ -218,7 +232,7 @@ def AUDIO_CONFIGURATION(audiotype, encode_type):
218232
elif (audiotype == "1" or audiotype == "2" or audiotype == "3"):
219233
audio_config = audio_solo_config(audionum, audiolang, config)
220234

221-
return (audio_config, audiocodec, lang, audiolang)
235+
return (audio_config, audiocodec, lang, audiolang, audionum, audionum2)
222236

223237

224238
def RELEASE_FINAL_TITLE(audiocodec, lang, form, xcod, tag, extend):

app/modules/mkvmerge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def EXT_NA_sS(thumb, title, year, stag, mark, extend, forced,
186186
.format(thumb, title, year, stag, mark, extend,
187187
forced, sync, titlesub, charset, idsub))
188188

189-
# --------- NO SUBTITLES ( INT )----------
189+
# --------- NO SUBTITLES ( INT ) ----------
190190

191191

192192
# INT > Multi Audio / NOSUBS

app/system.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ def completer(text, state):
109109

110110
# MUXING MODE
111111
if (encode_type == "1"):
112-
(mkvmerge, tools) = MUXING_MODE(encode_type, source, title, year, stag)
112+
(mkvmerge, mkvextract,
113+
tools) = MUXING_MODE(encode_type, source, title, year, stag, folder)
113114
try:
114115
muxing_process()
116+
subprocess.check_output(mkvextract, shell=True)
115117
subprocess.check_output(mkvmerge, shell=True)
116118
muxing_success()
117119
os.system(tools)
@@ -160,8 +162,8 @@ def completer(text, state):
160162
audiotype = ask_audio_type()
161163

162164
# Audio Configuration
163-
(audio_config, audiocodec, lang,
164-
audiolang) = AUDIO_CONFIGURATION(audiotype, encode_type)
165+
(audio_config, audiocodec, lang, audiolang, audionum,
166+
audionum2) = AUDIO_CONFIGURATION(audiotype, encode_type)
165167

166168
# Release Title
167169
(mark, prezquality) = RELEASE_FINAL_TITLE(audiocodec, lang, form,

0 commit comments

Comments
 (0)