mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-28 19:47:41 +08:00
feat: 添加下载任务时增加辅助识别
This commit is contained in:
@@ -6,12 +6,13 @@ from app import schemas
|
|||||||
from app.chain.download import DownloadChain
|
from app.chain.download import DownloadChain
|
||||||
from app.chain.media import MediaChain
|
from app.chain.media import MediaChain
|
||||||
from app.core.context import MediaInfo, Context, TorrentInfo
|
from app.core.context import MediaInfo, Context, TorrentInfo
|
||||||
|
from app.core.event import eventmanager
|
||||||
from app.core.metainfo import MetaInfo
|
from app.core.metainfo import MetaInfo
|
||||||
from app.core.security import verify_token
|
from app.core.security import verify_token
|
||||||
from app.db.models.user import User
|
from app.db.models.user import User
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.db.user_oper import get_current_active_user
|
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()
|
router = APIRouter()
|
||||||
|
|
||||||
@@ -77,7 +78,11 @@ def add(
|
|||||||
# 媒体信息
|
# 媒体信息
|
||||||
mediainfo = MediaChain().recognize_media(meta=metainfo, tmdbid=tmdbid, doubanid=doubanid)
|
mediainfo = MediaChain().recognize_media(meta=metainfo, tmdbid=tmdbid, doubanid=doubanid)
|
||||||
if not mediainfo:
|
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 = TorrentInfo()
|
||||||
torrentinfo.from_dict(torrent_in.model_dump())
|
torrentinfo.from_dict(torrent_in.model_dump())
|
||||||
|
|||||||
Reference in New Issue
Block a user