From ea2de8270b47716b6bd11966d23fb51d6b446fe0 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 27 Apr 2022 07:40:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4PROD=5FENV=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 3 --- controller/api/config_blueprint.py | 5 +++-- workflow/video.py | 7 ++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/config.py b/config.py index 1472e12..86dcc8c 100644 --- a/config.py +++ b/config.py @@ -1,9 +1,6 @@ import configparser import os.path -from flask.helpers import get_env - -PROD_ENV = get_env() == "production" # [danmaku] # exec diff --git a/controller/api/config_blueprint.py b/controller/api/config_blueprint.py index bb5d9ff..750c1af 100644 --- a/controller/api/config_blueprint.py +++ b/controller/api/config_blueprint.py @@ -1,6 +1,7 @@ from flask import Blueprint, jsonify, request +from flask.helpers import get_env -from config import get_config, write_config, load_config, PROD_ENV +from config import get_config, write_config, load_config blueprint = Blueprint("api_config", __name__, url_prefix="/api/config") @@ -13,7 +14,7 @@ def get_global_config(): @blueprint.get("/env") def get_current_env(): return jsonify({ - "prod": PROD_ENV + "prod": get_env() == "production" }) diff --git a/workflow/video.py b/workflow/video.py index a7c6147..cc1e5ad 100644 --- a/workflow/video.py +++ b/workflow/video.py @@ -5,7 +5,7 @@ from datetime import datetime, timedelta from typing import IO from config import FFMPEG_EXEC, VIDEO_BITRATE, FFMPEG_USE_NVIDIA_GPU, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC, \ - PROD_ENV, FFMPEG_USE_INTEL_GPU + FFMPEG_USE_INTEL_GPU def base_ts_to_filename(start_ts: float, is_mp4=False) -> str: @@ -161,12 +161,9 @@ def handle_ffmpeg_output(stderr: IO[bytes]) -> str: break if line.startswith(b"out_time="): out_time = line.replace(b"out_time=", b"").decode().strip() - if not PROD_ENV: - print("CurTime", out_time) if line.startswith(b"speed="): speed = line.replace(b"speed=", b"").decode().strip() - if not PROD_ENV: - print("Speed", speed) + print("Speed:", out_time, "@", speed) return out_time