Merge remote-tracking branch 'origin/main'

This commit is contained in:
jxxghp
2023-08-17 14:14:48 +08:00

View File

@ -7,6 +7,7 @@ from typing import Any, List, Dict, Tuple, Optional
import pytz import pytz
from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger from apscheduler.triggers.cron import CronTrigger
from torrentool.bencode import Bencode
from torrentool.torrent import Torrent from torrentool.torrent import Torrent
from app.core.config import settings from app.core.config import settings
@ -582,9 +583,9 @@ class TorrentTransfer(_PluginBase):
# 尝试补充trackers # 尝试补充trackers
try: try:
# 解析fastresume文件 # 解析fastresume文件
torrent_fastresume = Torrent.from_file(fastresume_file) torrent_fastresume = Bencode.read_file(fastresume_file, byte_keys={'pieces'})
# 读取trackers # 读取trackers
fastresume_trackers = torrent_fastresume.announce_urls fastresume_trackers = torrent_fastresume.get("trackers")
if fastresume_trackers: if fastresume_trackers:
# 重新赋值 # 重新赋值
torrent_main.announce_urls = fastresume_trackers torrent_main.announce_urls = fastresume_trackers