去除PROD_ENV依赖

This commit is contained in:
Jerry Yan 2022-04-27 07:40:23 +08:00
parent daeed748ff
commit ea2de8270b
3 changed files with 5 additions and 10 deletions

View File

@ -1,9 +1,6 @@
import configparser
import os.path
from flask.helpers import get_env
PROD_ENV = get_env() == "production"
# [danmaku]
# exec

View File

@ -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"
})

View File

@ -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