From ff0c41504349d594e4eec8c774a375d31808343d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Fri, 29 Mar 2024 14:00:44 +0800 Subject: [PATCH] =?UTF-8?q?qb=E7=A7=8D=E5=AD=90=E6=96=87=E4=BB=B6=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 因为qb从4.4.0开始,种子文件不再以Hash来命名了 --- plugins/crossseed/__init__.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/plugins/crossseed/__init__.py b/plugins/crossseed/__init__.py index 3b9e408..a05945f 100644 --- a/plugins/crossseed/__init__.py +++ b/plugins/crossseed/__init__.py @@ -705,15 +705,29 @@ class CrossSeed(_PluginBase): save_path = self.__get_save_path(torrent, downloader) # 获取种子文件路径 torrent_path = Path(self._torrentpaths[idx]) / f"{hash_str}.torrent" + torrent_info = None if not torrent_path.exists(): - logger.error(f"种子文件不存在:{torrent_path}") - continue + if downloader == "qbittorrent": + # FIXME qb从4.4.0开始,种子文件以标题+序号的方式保存,目前只能尝试导出后再解析 + # logger.info(f"正在导出种子 {torrent.get('name')}({hash_str})") + try: + torrent_data = torrent.export() + torrent_info, err = TorInfo.from_data(torrent_data) + except Exception as e: + err = str(e) + if not torrent_info: + logger.error(f"尝试导出种子 {hash_str} 出错 {err}") + continue + else: + logger.error(f"种子文件不存在:{torrent_path}") + continue # 读取种子文件具体信息 - torrent_info, err = self.cross_helper.get_local_torrent_info(torrent_path) if not torrent_info: - logger.error(f"未能读取到种子文件具体信息:{torrent_path} {err}") - continue + torrent_info, err = self.cross_helper.get_local_torrent_info(torrent_path) + if not torrent_info: + logger.error(f"未能读取到种子文件具体信息:{torrent_path} {err}") + continue # 用站点+pieces_hash记录该站点是否已经在该下载器中,需要从tracker补充站点名字 tracker_urls = set()