添加prod判断

This commit is contained in:
2022-04-18 09:37:51 +08:00
parent 289a46ab42
commit 07e695c945
3 changed files with 17 additions and 2 deletions

@ -4,7 +4,7 @@ import subprocess
from datetime import datetime, timedelta
from typing import IO
from config import FFMPEG_EXEC, VIDEO_BITRATE, FFMPEG_USE_GPU, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC
from config import FFMPEG_EXEC, VIDEO_BITRATE, FFMPEG_USE_GPU, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC, PROD_ENV
def get_video_real_duration(filename):
@ -33,6 +33,7 @@ def encode_video_with_subtitles(orig_filename: str, subtitles: list[str], new_fi
new_filename
], stdout=subprocess.PIPE)
handle_ffmpeg_output(encode_process.stdout)
return encode_process.wait()
def handle_ffmpeg_output(stderr: IO[bytes]) -> None:
@ -40,6 +41,9 @@ def handle_ffmpeg_output(stderr: IO[bytes]) -> None:
line = stderr.readline()
if line == b"":
break
if PROD_ENV:
# 正式环境不要输出一大堆的东西了
continue
if line.startswith(b"out_time="):
cur_time = line.replace(b"out_time=", b"").decode()
print("CurTime", cur_time.strip())