raise exception when retcode != 0
This commit is contained in:
@@ -71,7 +71,7 @@ async def _main(srt_data, voice_name, out_file):
|
|||||||
)
|
)
|
||||||
mother_temp_file = tempfile.NamedTemporaryFile(suffix=".mp3", delete=False)
|
mother_temp_file = tempfile.NamedTemporaryFile(suffix=".mp3", delete=False)
|
||||||
try:
|
try:
|
||||||
subprocess.call(
|
process = subprocess.call(
|
||||||
[
|
[
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
"-y",
|
"-y",
|
||||||
@@ -86,6 +86,8 @@ async def _main(srt_data, voice_name, out_file):
|
|||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
|
if process != 0:
|
||||||
|
raise Exception("ffmpeg failed")
|
||||||
|
|
||||||
input_files = []
|
input_files = []
|
||||||
input_files_start = {}
|
input_files_start = {}
|
||||||
@@ -150,13 +152,15 @@ async def _main(srt_data, voice_name, out_file):
|
|||||||
temporary_file2 = tempfile.NamedTemporaryFile(suffix=".mp3", delete=False)
|
temporary_file2 = tempfile.NamedTemporaryFile(suffix=".mp3", delete=False)
|
||||||
try:
|
try:
|
||||||
print("Concatenating...")
|
print("Concatenating...")
|
||||||
subprocess.call(
|
process = subprocess.call(
|
||||||
["ffmpeg", "-y", "-i", mother_temp_file.name]
|
["ffmpeg", "-y", "-i", mother_temp_file.name]
|
||||||
+ ffmpeg_opts
|
+ ffmpeg_opts
|
||||||
+ [temporary_file2.name],
|
+ [temporary_file2.name],
|
||||||
stdout=subprocess.DEVNULL,
|
#stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
#stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
|
if process != 0:
|
||||||
|
raise Exception("ffmpeg failed")
|
||||||
finally:
|
finally:
|
||||||
temporary_file2.close()
|
temporary_file2.close()
|
||||||
mother_temp_file.close()
|
mother_temp_file.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user