Files
meijiaka-zy/python-api/app/models/bgm_music.py
T
小鱼开发 4af42c157e fix: BGM 混音链路修复——URL 先下载到本地缓存再混音
- fix: 删除 BGM 预览硬编码开发者路径,改为使用 url 字段
- fix: BGM 混音前检测是否为 URL,先下载到 bgm_cache 本地缓存
- fix: Rust mix_bgm_to_video 恢复 validate_safe_path 校验,拒绝 URL
- feat: 新增 bgm_cache 目录及自动清理策略(30天/200MB上限)
- feat: Settings 缓存清理扩展为媒体缓存(video + BGM 统一清理)
- chore: BGM url 字段改为后端必填,同步 schema/model/seed/迁移
2026-05-25 00:54:17 +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] = mapped_column(
String(1024), nullable=False, 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="排序权重"
)