去除PROD_ENV依赖
This commit is contained in:
parent
daeed748ff
commit
ea2de8270b
@ -1,9 +1,6 @@
|
|||||||
import configparser
|
import configparser
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from flask.helpers import get_env
|
|
||||||
|
|
||||||
PROD_ENV = get_env() == "production"
|
|
||||||
|
|
||||||
# [danmaku]
|
# [danmaku]
|
||||||
# exec
|
# exec
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from flask import Blueprint, jsonify, request
|
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")
|
blueprint = Blueprint("api_config", __name__, url_prefix="/api/config")
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ def get_global_config():
|
|||||||
@blueprint.get("/env")
|
@blueprint.get("/env")
|
||||||
def get_current_env():
|
def get_current_env():
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"prod": PROD_ENV
|
"prod": get_env() == "production"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ from datetime import datetime, timedelta
|
|||||||
from typing import IO
|
from typing import IO
|
||||||
|
|
||||||
from config import FFMPEG_EXEC, VIDEO_BITRATE, FFMPEG_USE_NVIDIA_GPU, VIDEO_CLIP_EACH_SEC, VIDEO_CLIP_OVERFLOW_SEC, \
|
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:
|
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
|
break
|
||||||
if line.startswith(b"out_time="):
|
if line.startswith(b"out_time="):
|
||||||
out_time = line.replace(b"out_time=", b"").decode().strip()
|
out_time = line.replace(b"out_time=", b"").decode().strip()
|
||||||
if not PROD_ENV:
|
|
||||||
print("CurTime", out_time)
|
|
||||||
if line.startswith(b"speed="):
|
if line.startswith(b"speed="):
|
||||||
speed = line.replace(b"speed=", b"").decode().strip()
|
speed = line.replace(b"speed=", b"").decode().strip()
|
||||||
if not PROD_ENV:
|
print("Speed:", out_time, "@", speed)
|
||||||
print("Speed", speed)
|
|
||||||
|
|
||||||
return out_time
|
return out_time
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user