refactor: centralize MoviePilot server helper

This commit is contained in:
jxxghp
2026-05-27 12:56:45 +08:00
parent db3ad91408
commit 0e5c592862
28 changed files with 1927 additions and 1562 deletions

View File

@@ -21,6 +21,7 @@ from app.db.user_oper import (
get_current_active_superuser_async,
)
from app.factory import app
from app.helper.server import MoviePilotServerHelper
from app.helper.plugin import PluginHelper
from app.log import logger
from app.scheduler import Scheduler
@@ -217,7 +218,7 @@ async def statistic(_: schemas.TokenPayload = Depends(verify_token)) -> Any:
"""
插件安装统计
"""
return await PluginHelper().async_get_statistic()
return await MoviePilotServerHelper.async_get_plugin_statistic()
@router.get(
@@ -257,7 +258,7 @@ async def install(
)
if compatible_message:
return schemas.Response(success=False, message=compatible_message)
await plugin_helper.async_install_reg(pid=plugin_id, repo_url=repo_url)
await MoviePilotServerHelper.async_install_plugin_reg(plugin_id=plugin_id, repo_url=repo_url)
else:
# 插件不存在或需要强制安装,下载安装并注册插件
if repo_url:
@@ -267,6 +268,7 @@ async def install(
# 安装失败则直接响应
if not state:
return schemas.Response(success=False, message=msg)
await MoviePilotServerHelper.async_install_plugin_reg(plugin_id=plugin_id, repo_url=repo_url)
else:
# repo_url 为空时,也直接响应
return schemas.Response(