4af42c157e
- 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/迁移
30 lines
857 B
Python
30 lines
857 B
Python
"""
|
|
背景音乐 Schema
|
|
==============
|
|
"""
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class BgmMusicItem(BaseModel):
|
|
"""背景音乐项"""
|
|
|
|
id: int = Field(description="音乐ID")
|
|
title: str = Field(description="音乐名称")
|
|
artist: str | None = Field(default=None, description="艺术家")
|
|
category: str = Field(description="场景分类")
|
|
file_path: str = Field(description="相对文件路径")
|
|
url: str = Field(description="七牛云 URL")
|
|
duration: float | None = Field(default=None, description="时长(秒)")
|
|
sort_order: int = Field(default=0, description="排序权重")
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class BgmMusicListResponse(BaseModel):
|
|
"""背景音乐列表响应"""
|
|
|
|
items: list[BgmMusicItem] = Field(description="音乐列表")
|
|
total: int = Field(description="总数")
|