mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix: 修复站点用户数据转换并完善媒体来源扩展
This commit is contained in:
+17
-1
@@ -4,7 +4,7 @@ from typing import Iterable, Optional, Dict, Any, List, Set, Callable
|
||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||
|
||||
from app.schemas.common import JsonData
|
||||
from app.schemas.types import NotificationChannel
|
||||
from app.schemas.types import MediaType, NotificationChannel
|
||||
from app.schemas.file import FileItem
|
||||
from app.schemas.media import OptionalMediaIdentityMixin, RequiredMediaIdentityMixin
|
||||
from app.schemas.types import MediaSource
|
||||
@@ -527,6 +527,22 @@ class DiscoverMediaSource(BaseModel):
|
||||
return MediaSource(mediaid_prefix)
|
||||
|
||||
|
||||
class MediaSourceInfo(BaseModel):
|
||||
"""
|
||||
媒体数据源注册描述。
|
||||
|
||||
插件通过该描述声明来源的展示名称和支持的媒体类型;识别、搜索和刮削的
|
||||
实际实现仍由插件模块方法提供,宿主只负责把来源传递到统一媒体链路。
|
||||
"""
|
||||
|
||||
name: str = Field(..., description="数据源展示名称")
|
||||
media_source: MediaSource = Field(..., description="规范媒体来源标识")
|
||||
media_types: List[MediaType] = Field(
|
||||
default_factory=lambda: [MediaType.MOVIE, MediaType.TV],
|
||||
description="支持的媒体类型",
|
||||
)
|
||||
|
||||
|
||||
class DiscoverSourceEventData(ChainEventData):
|
||||
"""
|
||||
DiscoverSource 事件的数据模型
|
||||
|
||||
@@ -186,6 +186,7 @@ SCHEMA_EXPORTS = {
|
||||
'MediaServerPlayItem': ('app.schemas.mediaserver', 'MediaServerPlayItem'),
|
||||
'MediaServerSeasonInfo': ('app.schemas.mediaserver', 'MediaServerSeasonInfo'),
|
||||
'MediaSource': ('app.schemas.transfer', 'MediaSource'),
|
||||
'MediaSourceInfo': ('app.schemas.event', 'MediaSourceInfo'),
|
||||
'MediaType': ('app.schemas.subscribe', 'MediaType'),
|
||||
'Message': ('app.schemas.message', 'Message'),
|
||||
'MessageClearBefore': ('app.schemas.message', 'MessageClearBefore'),
|
||||
@@ -420,7 +421,7 @@ SCHEMA_CONFLICTS = {
|
||||
'LocaleHelper': ['app.schemas.dashboard', 'app.schemas.response'],
|
||||
'MediaInfo': ['app.schemas.context', 'app.schemas.system', 'app.schemas.transfer', 'app.schemas.workflow'],
|
||||
'MediaSource': ['app.schemas.cache', 'app.schemas.context', 'app.schemas.event', 'app.schemas.history', 'app.schemas.mediaserver', 'app.schemas.music', 'app.schemas.subscribe', 'app.schemas.transfer'],
|
||||
'MediaType': ['app.schemas.mediaserver', 'app.schemas.subscribe'],
|
||||
'MediaType': ['app.schemas.event', 'app.schemas.mediaserver', 'app.schemas.subscribe'],
|
||||
'MetaInfo': ['app.schemas.context', 'app.schemas.system', 'app.schemas.transfer'],
|
||||
'MusicInfo': ['app.schemas.context', 'app.schemas.music', 'app.schemas.transfer'],
|
||||
'MusicMeta': ['app.schemas.context', 'app.schemas.music', 'app.schemas.transfer'],
|
||||
|
||||
@@ -124,6 +124,9 @@ class SiteUserData(BaseModel):
|
||||
# 更新时间
|
||||
updated_time: Optional[str] = None
|
||||
|
||||
# 查询仓储返回 SQLAlchemy ORM 对象时,从对象属性读取字段。
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class SiteAuth(BaseModel):
|
||||
"""站点认证模块及其参数。"""
|
||||
|
||||
Reference in New Issue
Block a user