mirror of
https://github.com/sun-guannan/CapCutAPI.git
synced 2025-11-25 03:15:00 +08:00
Initial commit: CapCutAPI - 轻量、灵活、易上手的剪映/CapCut API工具
This commit is contained in:
36
settings/__init__.py
Normal file
36
settings/__init__.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
配置包入口,导出所有配置
|
||||
"""
|
||||
|
||||
# 从local模块导入所有配置,local模块已经导入了env和base模块的配置
|
||||
from .local import *
|
||||
|
||||
__all__ = [
|
||||
"IS_CAPCUT_ENV",
|
||||
"API_KEYS",
|
||||
"MODEL_CONFIG",
|
||||
"PURCHASE_LINKS",
|
||||
"LICENSE_CONFIG"
|
||||
]
|
||||
|
||||
# 提供一个获取平台信息的辅助函数
|
||||
def get_platform_info():
|
||||
"""
|
||||
获取平台信息,用于script_file.py中的dumps方法,cap_cut需要返回platform信息
|
||||
|
||||
Returns:
|
||||
dict: 平台信息字典
|
||||
"""
|
||||
if not IS_CAPCUT_ENV:
|
||||
return None
|
||||
|
||||
return {
|
||||
"app_id": 359289,
|
||||
"app_source": "cc",
|
||||
"app_version": "6.5.0",
|
||||
"device_id": "c4ca4238a0b923820dcc509a6f75849b",
|
||||
"hard_disk_id": "307563e0192a94465c0e927fbc482942",
|
||||
"mac_address": "c3371f2d4fb02791c067ce44d8fb4ed5",
|
||||
"os": "mac",
|
||||
"os_version": "15.5"
|
||||
}
|
||||
55
settings/local.py
Normal file
55
settings/local.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
本地配置模块,用于从本地配置文件中加载配置
|
||||
"""
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_FILE_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json")
|
||||
|
||||
# 默认配置
|
||||
IS_CAPCUT_ENV = True
|
||||
|
||||
# 默认域名配置
|
||||
DRAFT_DOMAIN = "https://www.install-ai-guider.top"
|
||||
|
||||
# 默认预览路由
|
||||
PREVIEW_ROUTER = "/draft/downloader"
|
||||
|
||||
# 是否上传草稿文件
|
||||
IS_UPLOAD_DRAFT = False
|
||||
|
||||
# 尝试加载本地配置文件
|
||||
if os.path.exists(CONFIG_FILE_PATH):
|
||||
try:
|
||||
with open(CONFIG_FILE_PATH, "r", encoding="utf-8") as f:
|
||||
local_config = json.load(f)
|
||||
|
||||
# 更新是否是国际版
|
||||
if "is_capcut_env" in local_config:
|
||||
IS_CAPCUT_ENV = local_config["is_capcut_env"]
|
||||
|
||||
# 更新域名配置
|
||||
if "draft_domain" in local_config:
|
||||
DRAFT_DOMAIN = local_config["draft_domain"]
|
||||
|
||||
# 更新预览路由
|
||||
if "preview_router" in local_config:
|
||||
PREVIEW_ROUTER = local_config["preview_router"]
|
||||
|
||||
# 更新是否上传草稿文件
|
||||
if "is_upload_draft" in local_config:
|
||||
IS_UPLOAD_DRAFT = local_config["is_upload_draft"]
|
||||
|
||||
# 更新OSS配置
|
||||
if "oss_config" in local_config:
|
||||
OSS_CONFIG = local_config["oss_config"]
|
||||
|
||||
# 更新MP4 OSS配置
|
||||
if "mp4_oss_config" in local_config:
|
||||
MP4_OSS_CONFIG = local_config["mp4_oss_config"]
|
||||
|
||||
except (json.JSONDecodeError, IOError):
|
||||
# 配置文件加载失败,使用默认配置
|
||||
pass
|
||||
Reference in New Issue
Block a user