mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor(media): unify media identity and chain responsibilities
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from enum import Enum
|
||||
from typing import Literal, Optional
|
||||
from typing import Literal, Optional, Tuple, Union
|
||||
|
||||
|
||||
# 音乐实体命名空间由公共类型模块统一持有,避免模型、接口和工具层重复定义。
|
||||
@@ -68,6 +68,10 @@ class MediaSource(str, Enum):
|
||||
return self.value
|
||||
|
||||
|
||||
# 搜索可以选择一个或多个来源,但集合中的每一项都必须是固定枚举。
|
||||
MediaSourceSelection = Union[MediaSource, Tuple[MediaSource, ...]]
|
||||
|
||||
|
||||
def media_type_to_agent(value) -> Optional[str]:
|
||||
"""将枚举、Agent 键或数据库枚举值统一转换为 Agent 媒体类型。"""
|
||||
if isinstance(value, MediaType):
|
||||
|
||||
Reference in New Issue
Block a user