Files
meijiaka-zy/python-api/app/models/bgm_music.py
T
小鱼开发 06ec0ee202 feat: BGM 云端化 + 步骤页面 UI 统一重构
后端:
- 新增 BGM 数据库模型、Schema、CRUD、API 路由
- BgmMusic 增加 url 字段存储七牛云地址
- Alembic 迁移: 创建 BGM 表 + 添加 url 字段
- import_bgm.py 导入时自动上传七牛云 (meijiaka-zy/bgm/...)

前端:
- VideoCompose BGM 选择改为卡片弹窗 (系统BGM + 本地上传)
- 去掉 BGM 硬编码本地路径, 直接使用云端 URL
- CoverDesign 视觉重构: 绿色边框卡片、角标、hover 遮罩
- CoverDesign 去掉预选背景, 默认空白需手动选择
- 所有步骤按钮规范统一: 左=重新生成(主色), 右=导出/预览(次色)
- 预览按钮状态统一: 文字变为'视频预览中...', 保持 btn-secondary
- 去掉所有步骤按钮的 svg/emoji 图标

Rust:
- mix_bgm_to_video 支持临时文件保护 (输入输出同路径时自动中转)
- FFmpeg BGM 混合使用 aloop 循环 + amix 滤镜
2026-05-24 15:39:54 +08:00

51 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
背景音乐模型
==========
装修行业场景化 BGM 库,按知识科普/案例展示/促销活动/家居生活/智能家居
五个场景分类管理。
"""
from sqlalchemy import Float, Integer, String
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import BaseModelBigInt
class BgmMusic(BaseModelBigInt):
"""
背景音乐表
Attributes:
title: 音乐名称
artist: 艺术家
category: 场景分类 (knowledge/showcase/promotion/lifestyle/tech)
file_path: 相对文件路径(如 knowledge/3_Dance_with_Me.mp3
duration: 时长(秒)
status: 状态 (active/inactive)
sort_order: 排序权重(越小越靠前)
"""
__tablename__ = "mjk_bgm_musics"
title: Mapped[str] = mapped_column(String(255), nullable=False, comment="音乐名称")
artist: Mapped[str] = mapped_column(String(255), nullable=True, comment="艺术家")
category: Mapped[str] = mapped_column(
String(32), nullable=False, index=True, comment="场景分类"
)
file_path: Mapped[str] = mapped_column(
String(512), nullable=False, comment="相对文件路径"
)
url: Mapped[str | None] = mapped_column(
String(1024), nullable=True, comment="七牛云 URL"
)
duration: Mapped[float] = mapped_column(
Float, nullable=True, comment="时长(秒)"
)
status: Mapped[str] = mapped_column(
String(16), default="active", nullable=False, comment="状态: active/inactive"
)
sort_order: Mapped[int] = mapped_column(
Integer, default=0, nullable=False, comment="排序权重"
)