diff --git a/config.py b/config.py index e382429..46b1345 100644 --- a/config.py +++ b/config.py @@ -27,6 +27,8 @@ VIDEO_BITRATE = "2.5M" # crf VIDEO_CRF = 28 # [video] +# enabled +VIDEO_ENABLED = False # title VIDEO_TITLE = "【永恒de草薙直播录播】直播于 {}" # desc @@ -70,7 +72,8 @@ def load_config(): VIDEO_RESOLUTION = section.get('resolution', VIDEO_RESOLUTION) if config.has_section("video"): section = config['video'] - global VIDEO_TITLE, VIDEO_DESC, VIDEO_TID, VIDEO_TAGS + global VIDEO_ENABLED, VIDEO_TITLE, VIDEO_DESC, VIDEO_TID, VIDEO_TAGS + VIDEO_ENABLED = section.getboolean('enabled', VIDEO_ENABLED) VIDEO_TITLE = section.get('title', VIDEO_TITLE) VIDEO_DESC = section.get('desc', VIDEO_DESC) VIDEO_TID = section.getint('tid', VIDEO_TID) @@ -108,6 +111,7 @@ def get_config(): 'resolution': VIDEO_RESOLUTION, }, 'video': { + 'enabled': VIDEO_ENABLED, 'title': VIDEO_TITLE, 'desc': VIDEO_DESC, 'tid': VIDEO_TID, diff --git a/controller/api/bilirecorder_blueprint.py b/controller/api/bilirecorder_blueprint.py index de8c61e..0d9e460 100644 --- a/controller/api/bilirecorder_blueprint.py +++ b/controller/api/bilirecorder_blueprint.py @@ -7,7 +7,7 @@ from typing import Optional from flask import Blueprint, jsonify, request, current_app from config import BILILIVE_RECORDER_DIRECTORY, VIDEO_TITLE, XIGUALIVE_RECORDER_DIRECTORY, VIDEO_DESC, \ - VIDEO_TAGS, VIDEO_TID + VIDEO_TAGS, VIDEO_TID, VIDEO_ENABLED from exception.danmaku import DanmakuException from model import db from model.DanmakuClip import DanmakuClip @@ -49,14 +49,17 @@ def auto_submit_task(): *[clip.full_path for clip in video_clip.danmaku_clips[1:]] ) clear_item() - def _encode_finish_callback(_f: "Future"): - _result = _f.result() - if _result: - # start uploading - bilibili_instance.pre_upload( - parts=[VideoPart(os.path.join(_item['base_path'], _item['file']), _item['file']) for _item in - _result]) - _future.add_done_callback(_encode_finish_callback) + if VIDEO_ENABLED: + def _encode_finish_callback(_f: "Future"): + _result = _f.result() + if _result: + # start uploading + bilibili_instance.pre_upload( + parts=[VideoPart(os.path.join(_item['base_path'], _item['file']), _item['file']) for _item + in + _result]) + + _future.add_done_callback(_encode_finish_callback) else: print("[-]Workflow:", bili_record_workflow_item.id, "; Video:", video_clip.full_path, "; No Danmaku") if _future is not None: diff --git a/templates/index.html b/templates/index.html index 0e22acd..b3f3214 100644 --- a/templates/index.html +++ b/templates/index.html @@ -187,10 +187,14 @@
上传配置Alpha | +上传配置Beta | ||
是否开启 | ++ | ||
视频标题Pattern | {{ config.video.title }} | @@ -278,6 +282,7 @@ resolution: "", }, video: { + enabled: false, title: "", desc: "", tid: 0,