diff --git a/app/chain/download.py b/app/chain/download.py index b10bb56b..b09a4f38 100644 --- a/app/chain/download.py +++ b/app/chain/download.py @@ -225,6 +225,7 @@ class DownloadChain(ChainBase): _torrent = context.torrent_info _media = context.media_info _meta = context.meta_info + _downloader = _torrent.site_downloader # 补充完整的media数据 if not _media.genre_ids: @@ -287,7 +288,7 @@ class DownloadChain(ChainBase): episodes=episodes, download_dir=download_dir, category=_media.category, - downloader=downloader) + downloader=downloader or _downloader) if result: _downloader, _hash, error_msg = result else: diff --git a/app/chain/torrents.py b/app/chain/torrents.py index a2b5c9db..9dd91837 100644 --- a/app/chain/torrents.py +++ b/app/chain/torrents.py @@ -120,6 +120,7 @@ class TorrentsChain(ChainBase, metaclass=Singleton): site_ua=site.get("ua") or settings.USER_AGENT, site_proxy=site.get("proxy"), site_order=site.get("pri"), + site_downloader=site.get("downloader"), title=item.get("title"), enclosure=item.get("enclosure"), page_url=item.get("link"), diff --git a/app/core/context.py b/app/core/context.py index 56e75264..2bd05d78 100644 --- a/app/core/context.py +++ b/app/core/context.py @@ -23,6 +23,8 @@ class TorrentInfo: site_proxy: bool = False # 站点优先级 site_order: int = 0 + # 站点下载器 + site_downloader: str = None # 种子名称 title: str = None # 种子副标题 diff --git a/app/db/models/site.py b/app/db/models/site.py index bf15569e..717b430e 100644 --- a/app/db/models/site.py +++ b/app/db/models/site.py @@ -51,6 +51,8 @@ class Site(Base): is_active = Column(Boolean(), default=True) # 创建时间 lst_mod_date = Column(String, default=datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + # 下载器 + downloader = Column(String) @staticmethod @db_query diff --git a/app/modules/indexer/__init__.py b/app/modules/indexer/__init__.py index 5edf56f3..14c66daa 100644 --- a/app/modules/indexer/__init__.py +++ b/app/modules/indexer/__init__.py @@ -191,6 +191,7 @@ class IndexerModule(_ModuleBase): site_ua=site.get("ua"), site_proxy=site.get("proxy"), site_order=site.get("pri"), + site_downloader=site.get("downloader"), **result) for result in result_array] # 去重 return __remove_duplicate(torrents) @@ -199,7 +200,7 @@ class IndexerModule(_ModuleBase): def __spider_search(indexer: CommentedMap, search_word: str = None, mtype: MediaType = None, - page: int = 0) -> (bool, List[dict]): + page: int = 0) -> Tuple[bool, List[dict]]: """ 根据关键字搜索单个站点 :param: indexer: 站点配置 diff --git a/app/schemas/context.py b/app/schemas/context.py index 8eadca10..bf065cbe 100644 --- a/app/schemas/context.py +++ b/app/schemas/context.py @@ -180,6 +180,8 @@ class TorrentInfo(BaseModel): site_proxy: Optional[bool] = False # 站点优先级 site_order: Optional[int] = 0 + # 站点下载器 + site_downloader: Optional[str] = None # 种子名称 title: Optional[str] = None # 种子副标题 diff --git a/app/schemas/site.py b/app/schemas/site.py index ef64a3de..42157d1a 100644 --- a/app/schemas/site.py +++ b/app/schemas/site.py @@ -44,6 +44,8 @@ class Site(BaseModel): limit_seconds: Optional[int] = None # 是否启用 is_active: Optional[bool] = True + # 下载器 + downloader: Optional[str] = None class Config: orm_mode = True