Move category methods to ChainBase and use consistent naming

Co-authored-by: jxxghp <51039935+jxxghp@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-26 04:32:11 +00:00
co-authored by jxxghp
parent 5d3443fee4
commit 2883ccbe87
3 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ def get_category_config(_: User = Depends(get_current_active_user)):
""" """
获取分类策略配置 获取分类策略配置
""" """
config = TmdbChain().load_category_config() config = TmdbChain().category_config()
return schemas.Response(success=True, data=config.model_dump()) return schemas.Response(success=True, data=config.model_dump())
+13
View File
@@ -26,6 +26,7 @@ from app.helper.service import ServiceConfigHelper
from app.log import logger from app.log import logger
from app.schemas import TransferInfo, TransferTorrent, ExistMediaInfo, DownloadingTorrent, CommingMessage, Notification, \ from app.schemas import TransferInfo, TransferTorrent, ExistMediaInfo, DownloadingTorrent, CommingMessage, Notification, \
WebhookEventInfo, TmdbEpisode, MediaPerson, FileItem, TransferDirectoryConf WebhookEventInfo, TmdbEpisode, MediaPerson, FileItem, TransferDirectoryConf
from app.schemas.category import CategoryConfig
from app.schemas.types import TorrentStatus, MediaType, MediaImageType, EventType, MessageChannel from app.schemas.types import TorrentStatus, MediaType, MediaImageType, EventType, MessageChannel
from app.utils.object import ObjectUtils from app.utils.object import ObjectUtils
@@ -1062,6 +1063,18 @@ class ChainBase(metaclass=ABCMeta):
""" """
return self.run_module("media_category") return self.run_module("media_category")
def category_config(self) -> CategoryConfig:
"""
获取分类策略配置
"""
return self.run_module("load_category_config")
def save_category_config(self, config: CategoryConfig) -> bool:
"""
保存分类策略配置
"""
return self.run_module("save_category_config", config=config)
def register_commands(self, commands: Dict[str, dict]) -> None: def register_commands(self, commands: Dict[str, dict]) -> None:
""" """
注册菜单命令 注册菜单命令
-13
View File
@@ -5,7 +5,6 @@ from app import schemas
from app.chain import ChainBase from app.chain import ChainBase
from app.core.context import MediaInfo from app.core.context import MediaInfo
from app.schemas import MediaType from app.schemas import MediaType
from app.schemas.category import CategoryConfig
class TmdbChain(ChainBase): class TmdbChain(ChainBase):
@@ -321,15 +320,3 @@ class TmdbChain(ChainBase):
if infos: if infos:
return [info.backdrop_path for info in infos if info and info.backdrop_path][:num] return [info.backdrop_path for info in infos if info and info.backdrop_path][:num]
return [] return []
def load_category_config(self) -> CategoryConfig:
"""
加载分类策略配置
"""
return self.run_module("load_category_config")
def save_category_config(self, config: CategoryConfig) -> bool:
"""
保存分类策略配置
"""
return self.run_module("save_category_config", config=config)