diff --git a/app/api/endpoints/download.py b/app/api/endpoints/download.py index 5eb6a4c5..23a137dc 100644 --- a/app/api/endpoints/download.py +++ b/app/api/endpoints/download.py @@ -6,12 +6,13 @@ from app import schemas from app.chain.download import DownloadChain from app.chain.media import MediaChain from app.core.context import MediaInfo, Context, TorrentInfo +from app.core.event import eventmanager from app.core.metainfo import MetaInfo from app.core.security import verify_token from app.db.models.user import User from app.db.systemconfig_oper import SystemConfigOper from app.db.user_oper import get_current_active_user -from app.schemas.types import SystemConfigKey +from app.schemas.types import ChainEventType, SystemConfigKey router = APIRouter() @@ -77,7 +78,11 @@ def add( # 媒体信息 mediainfo = MediaChain().recognize_media(meta=metainfo, tmdbid=tmdbid, doubanid=doubanid) if not mediainfo: - return schemas.Response(success=False, message="无法识别媒体信息") + # 尝试使用辅助识别,如果有注册响应事件的话 + if eventmanager.check(ChainEventType.NameRecognize): + mediainfo = MediaChain().recognize_help(title=torrent_in.title, org_meta=metainfo) + if not mediainfo: + return schemas.Response(success=False, message="无法识别媒体信息") # 种子信息 torrentinfo = TorrentInfo() torrentinfo.from_dict(torrent_in.model_dump())