fix cache

This commit is contained in:
jxxghp
2025-08-23 14:06:44 +08:00
parent fcadac2adb
commit 343109836f
5 changed files with 109 additions and 265 deletions

View File

@@ -16,11 +16,10 @@ from app.db.systemconfig_oper import SystemConfigOper
from app.log import logger
from app.schemas.types import MediaType, SystemConfigKey
from app.utils.http import RequestUtils
from app.utils.singleton import WeakSingleton
from app.utils.string import StringUtils
class TorrentHelper(metaclass=WeakSingleton):
class TorrentHelper:
"""
种子帮助类
"""
@@ -199,17 +198,14 @@ class TorrentHelper(metaclass=WeakSingleton):
:param torrent_content: 种子内容
:return: 文件夹名、文件清单,单文件种子返回空文件夹名
"""
if not torrent_content:
return "", []
# 检查是否为磁力链接
if isinstance(torrent_content, str) and torrent_content.startswith("magnet:"):
# 磁力链接无法预先获取文件信息,返回空
if StringUtils.is_magnet_link(torrent_content):
return "", []
elif isinstance(torrent_content, bytes) and torrent_content.startswith(b"magnet:"):
# 磁力链接无法预先获取文件信息,返回空
return "", []
try:
# 解析种子内容
torrentinfo = Torrent.from_string(torrent_content)