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

postprocess: tell the filenames to be strings.

this is an issue on windows.
This commit is contained in:
Johan Andersson 2021-05-10 20:51:55 +02:00
parent d5751122f4
commit e6379d9a28

View File

@ -37,7 +37,7 @@ class postprocess:
new_name = orig_filename.with_suffix(".mp4") new_name = orig_filename.with_suffix(".mp4")
cmd = [self.detect, "-i", orig_filename] cmd = [self.detect, "-i", str(orig_filename)]
_, stdout, stderr = run_program(cmd, False) # return 1 is good here. _, stdout, stderr = run_program(cmd, False) # return 1 is good here.
streams = _streams(stderr) streams = _streams(stderr)
videotrack, audiotrack = _checktracks(streams) videotrack, audiotrack = _checktracks(streams)
@ -72,12 +72,12 @@ class postprocess:
for subfix in self.subfixes: for subfix in self.subfixes:
# subfile = f"{name + subfix}.srt" # subfile = f"{name + subfix}.srt"
subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt") subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt")
cmd += ["-i", subfile] cmd += ["-i", str(subfile)]
else: else:
subfile = orig_filename.with_suffix(".srt") subfile = orig_filename.with_suffix(".srt")
cmd += ["-i", subfile] cmd += ["-i", str(subfile)]
arguments += ["-y", tempfile] arguments += ["-y", str(tempfile)]
cmd += arguments cmd += arguments
returncode, stdout, stderr = run_program(cmd) returncode, stdout, stderr = run_program(cmd)
if returncode != 0: if returncode != 0:
@ -114,9 +114,9 @@ class postprocess:
cmd = [self.detect] cmd = [self.detect]
if self.config.get("only_video") or not self.config.get("only_audio"): if self.config.get("only_video") or not self.config.get("only_audio"):
cmd += ["-i", orig_filename] cmd += ["-i", str(orig_filename)]
if self.config.get("only_audio") or not self.config.get("only_video"): if self.config.get("only_audio") or not self.config.get("only_video"):
cmd += ["-i", audio_filename] cmd += ["-i", str(audio_filename)]
_, stdout, stderr = run_program(cmd, False) # return 1 is good here. _, stdout, stderr = run_program(cmd, False) # return 1 is good here.
streams = _streams(stderr) streams = _streams(stderr)
videotrack, audiotrack = _checktracks(streams) videotrack, audiotrack = _checktracks(streams)
@ -133,9 +133,9 @@ class postprocess:
arguments += ["-bsf:a", "aac_adtstoasc"] arguments += ["-bsf:a", "aac_adtstoasc"]
cmd = [self.detect] cmd = [self.detect]
if self.config.get("only_video") or not self.config.get("only_audio"): if self.config.get("only_video") or not self.config.get("only_audio"):
cmd += ["-i", orig_filename] cmd += ["-i", str(orig_filename)]
if self.config.get("only_audio") or not self.config.get("only_video"): if self.config.get("only_audio") or not self.config.get("only_video"):
cmd += ["-i", audio_filename] cmd += ["-i", str(audio_filename)]
if videotrack: if videotrack:
arguments += ["-map", f"{videotrack}"] arguments += ["-map", f"{videotrack}"]
if audiotrack: if audiotrack:
@ -155,12 +155,12 @@ class postprocess:
if self.subfixes: if self.subfixes:
for subfix in self.subfixes: for subfix in self.subfixes:
subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt") subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt")
cmd += ["-i", subfile] cmd += ["-i", str(subfile)]
else: else:
subfile = orig_filename.with_suffix(".srt") subfile = orig_filename.with_suffix(".srt")
cmd += ["-i", subfile] cmd += ["-i", str(subfile)]
arguments += ["-y", tempfile] arguments += ["-y", str(tempfile)]
cmd += arguments cmd += arguments
returncode, stdout, stderr = run_program(cmd) returncode, stdout, stderr = run_program(cmd)
if returncode != 0: if returncode != 0: