1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

Fixed minor bug with manual mappings options for ffmpeg

also a tiny cleanup
This commit is contained in:
iwconfig 2016-06-30 22:30:55 +00:00
parent c5eea95c3f
commit 91cc1a18a2

View File

@ -13,9 +13,7 @@ class postprocess(object):
self.stream = stream self.stream = stream
self.merge_subtitle = options.merge_subtitle self.merge_subtitle = options.merge_subtitle
self.external_subtitle = options.subtitle self.external_subtitle = options.subtitle
self.require_subtitle = options.require_subtitle
self.get_all_subtitles = options.get_all_subtitles self.get_all_subtitles = options.get_all_subtitles
self.output = options.output
self.subfixes = subfixes self.subfixes = subfixes
self.detect = None self.detect = None
for i in ["ffmpeg", "avconv"]: for i in ["ffmpeg", "avconv"]:
@ -157,10 +155,8 @@ class postprocess(object):
if self.merge_subtitle: if self.merge_subtitle:
langs = self.sublanguage() langs = self.sublanguage()
stream = -1 for stream_num, language in enumerate(langs, start = 2):
for language in langs: arguments += ["-map", "0", "-map", "1", "-map", str(stream_num), "-c:s:" + str(stream_num - 2), "mov_text", "-metadata:s:s:" + str(stream_num - 2), "language=" + language]
stream += 1
arguments += ["-map", str(stream + 1), "-c:s:" + str(stream), "mov_text", "-metadata:s:s:" + str(stream), "language=" + language]
if len(self.subfixes) >= 2: if len(self.subfixes) >= 2:
for subfix in self.subfixes: for subfix in self.subfixes:
subfile = "{}.srt".format(name + subfix) subfile = "{}.srt".format(name + subfix)
@ -178,7 +174,7 @@ class postprocess(object):
msg = stderr.strip().split('\n')[-1] msg = stderr.strip().split('\n')[-1]
log.error("Something went wrong: %s", msg) log.error("Something went wrong: %s", msg)
return return
log.info("Merging done, removing old files.") log.info("Merging done, removing old files.")
os.remove(orig_filename) os.remove(orig_filename)
os.remove(audio_filename) os.remove(audio_filename)
@ -188,4 +184,4 @@ class postprocess(object):
subfile = "{}.srt".format(name + subfix) subfile = "{}.srt".format(name + subfix)
os.remove(subfile) os.remove(subfile)
else: os.remove(subfile) else: os.remove(subfile)
os.rename(tempfile, orig_filename) os.rename(tempfile, orig_filename)