forked from jxxghp/MoviePilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 资源包升级以提升安全性 - 优化了页面数据刷新机制 注意:本次升级后会默认清理一次种子识别缓存
- Loading branch information
Showing
6 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,25 @@ | ||
class BaseAction: | ||
from abc import ABC, abstractmethod | ||
|
||
from pydantic.main import BaseModel | ||
|
||
from app.schemas import ActionContext | ||
|
||
|
||
class BaseAction(BaseModel, ABC): | ||
""" | ||
工作流动作基类 | ||
""" | ||
async def execute(self, params: dict, context: dict) -> dict: | ||
|
||
@property | ||
@abstractmethod | ||
def name(self) -> str: | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def description(self) -> str: | ||
pass | ||
|
||
@abstractmethod | ||
async def execute(self, params: dict, context: ActionContext) -> ActionContext: | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from datetime import datetime | ||
|
||
from sqlalchemy import Column, Integer, JSON, Sequence, String | ||
|
||
from app.db import Base | ||
|
||
|
||
class Workflow(Base): | ||
""" | ||
工作流表 | ||
""" | ||
# ID | ||
id = Column(Integer, Sequence('id'), primary_key=True, index=True) | ||
# 名称 | ||
name = Column(String, index=True, nullable=False) | ||
# 描述 | ||
description = Column(String) | ||
# 定时器 | ||
timer = Column(String) | ||
# 状态:N-新建 R-运行中 P-暂停 S-成功 F-失败 | ||
state = Column(String, nullable=False, index=True, default='N') | ||
# 当前执行动作 | ||
current_action = Column(String) | ||
# 任务执行结果 | ||
result = Column(String) | ||
# 已执行次数 | ||
run_count = Column(Integer, default=0) | ||
# 任务列表 | ||
actions = Column(JSON, default=list) | ||
# 执行上下文 | ||
context = Column(JSON, default=dict) | ||
# 创建时间 | ||
add_time = Column(String, default=datetime.now().strftime('%Y-%m-%d %H:%M:%S')) | ||
# 最后执行时间 | ||
last_time = Column(String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Workflow(BaseModel): | ||
""" | ||
工作流信息 | ||
""" | ||
name: Optional[str] = Field(None, description="工作流名称") | ||
description: Optional[str] = Field(None, description="工作流描述") | ||
timer: Optional[str] = Field(None, description="定时器") | ||
state: Optional[str] = Field(None, description="状态") | ||
current_action: Optional[str] = Field(None, description="当前执行动作") | ||
result: Optional[str] = Field(None, description="任务执行结果") | ||
run_count: Optional[int] = Field(0, description="已执行次数") | ||
actions: Optional[list] = Field([], description="任务列表") | ||
add_time: Optional[str] = Field(None, description="创建时间") | ||
last_time: Optional[str] = Field(None, description="最后执行时间") | ||
|
||
|
||
class Action(BaseModel): | ||
""" | ||
动作信息 | ||
""" | ||
name: Optional[str] = Field(None, description="动作名称") | ||
description: Optional[str] = Field(None, description="动作描述") | ||
|
||
|
||
class ActionContext(BaseModel, ABC): | ||
""" | ||
动作上下文 | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""2.1.1 | ||
Revision ID: 279a949d81b6 | ||
Revises: ca5461f314f2 | ||
Create Date: 2025-02-14 19:02:24.989349 | ||
""" | ||
|
||
from app.chain.torrents import TorrentsChain | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '279a949d81b6' | ||
down_revision = 'ca5461f314f2' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# 清理一次缓存 | ||
TorrentsChain().clear_torrents() | ||
|
||
|
||
def downgrade() -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
APP_VERSION = 'v2.2.8-1' | ||
FRONTEND_VERSION = 'v2.2.8-1' | ||
APP_VERSION = 'v2.2.9' | ||
FRONTEND_VERSION = 'v2.2.9' |