From 492a8e3964ee540af2bceefa5a321307e93aa609 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 17 Aug 2023 13:17:52 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=A7=A3=E6=9E=90torrent=5Ffastresume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/plugins/torrenttransfer/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/plugins/torrenttransfer/__init__.py b/app/plugins/torrenttransfer/__init__.py index 79b96c7a..a1eab2ad 100644 --- a/app/plugins/torrenttransfer/__init__.py +++ b/app/plugins/torrenttransfer/__init__.py @@ -7,6 +7,7 @@ from typing import Any, List, Dict, Tuple, Optional import pytz from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.cron import CronTrigger +from torrentool.bencode import Bencode from torrentool.torrent import Torrent from app.core.config import settings @@ -582,9 +583,9 @@ class TorrentTransfer(_PluginBase): # 尝试补充trackers try: # 解析fastresume文件 - torrent_fastresume = Torrent.from_file(fastresume_file) + torrent_fastresume = Bencode.read_file(fastresume_file, byte_keys={'pieces'}) # 读取trackers - fastresume_trackers = torrent_fastresume.announce_urls + fastresume_trackers = torrent_fastresume.get("trackers") if fastresume_trackers: # 重新赋值 torrent_main.announce_urls = fastresume_trackers