mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
feat(event): support smart rename event
This commit is contained in:
+30
-1
@@ -1,4 +1,5 @@
|
||||
from typing import Optional, Dict
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any
|
||||
|
||||
from pydantic import BaseModel, Field, root_validator
|
||||
|
||||
@@ -114,3 +115,31 @@ class CommandRegisterEventData(ChainEventData):
|
||||
# 输出参数
|
||||
cancel: bool = Field(False, description="是否取消注册")
|
||||
source: str = Field("未知拦截源", description="拦截源")
|
||||
|
||||
|
||||
class SmartRenameEventData(ChainEventData):
|
||||
"""
|
||||
SmartRename 事件的数据模型
|
||||
|
||||
Attributes:
|
||||
# 输入参数
|
||||
template_string (str): Jinja2 模板字符串
|
||||
rename_dict (dict): 渲染上下文
|
||||
render_str (str): 渲染生成的字符串
|
||||
path (Optional[Path]): 当前文件的目标路径
|
||||
|
||||
# 输出参数
|
||||
updated (bool): 是否已更新,默认值为 False
|
||||
updated_str (str): 更新后的字符串
|
||||
source (str): 拦截源,默认值为 "未知拦截源"
|
||||
"""
|
||||
# 输入参数
|
||||
template_string: str = Field(..., description="模板字符串")
|
||||
rename_dict: Dict[str, Any] = Field(..., description="渲染上下文")
|
||||
path: Optional[Path] = Field(None, description="文件的目标路径")
|
||||
render_str: str = Field(..., description="渲染生成的字符串")
|
||||
|
||||
# 输出参数
|
||||
updated: bool = Field(False, description="是否已更新")
|
||||
updated_str: Optional[str] = Field(None, description="更新后的字符串")
|
||||
source: Optional[str] = Field("未知拦截源", description="拦截源")
|
||||
|
||||
@@ -60,14 +60,16 @@ class EventType(Enum):
|
||||
|
||||
# 同步链式事件
|
||||
class ChainEventType(Enum):
|
||||
# 名称识别请求
|
||||
# 名称识别
|
||||
NameRecognize = "name.recognize"
|
||||
# 认证验证请求
|
||||
# 认证验证
|
||||
AuthVerification = "auth.verification"
|
||||
# 认证拦截请求
|
||||
# 认证拦截
|
||||
AuthIntercept = "auth.intercept"
|
||||
# 命令注册请求
|
||||
# 命令注册
|
||||
CommandRegister = "command.register"
|
||||
# 智能重命名
|
||||
SmartRename = "SmartRename"
|
||||
|
||||
|
||||
# 系统配置Key字典
|
||||
|
||||
Reference in New Issue
Block a user