The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix: 恢复必要注释
XiaoYouChRca191d56ce31
diff --git a/features/bittorrent_pack/task.py b/features/bittorrent_pack/task.pyindex e5985346..672f2fd7 100644--- a/features/bittorrent_pack/task.py+++ b/features/bittorrent_pack/task.py@@ -341,7 +341,7 @@ class BTWorker(Worker):flags &= ~int(lt.torrent_flags.sequential_download)params.flags = flags | int(lt.torrent_flags.update_subscribe)- # ⚠️ 即使从 resume 恢复也要覆盖参数,确保用户修改的设置生效(路径、文件选择、限速等)+ # 即使从 resume 恢复也要覆盖参数,确保用户修改的设置生效params.save_path = str(self.task.path)params.storage_mode = lt.storage_mode_t.storage_mode_allocate if self.task.storageMode == "allocate" else lt.storage_mode_t.storage_mode_sparseparams.file_priorities = self.task.priorities()diff --git a/features/ftp_pack/task.py b/features/ftp_pack/task.pyindex 216c078e..6e176667 100644--- a/features/ftp_pack/task.py+++ b/features/ftp_pack/task.py@@ -79,6 +79,7 @@ class FtpConnectionInfo:sourcePath: str = "/"portSpecified: bool = False+# 选了不一定下载, 故拆成 FtpFile 和 FtpStage@dataclassclass FtpFile:index: intdiff --git a/features/http_pack/pack.py b/features/http_pack/pack.pyindex f7d44285..a79e7a69 100644--- a/features/http_pack/pack.py+++ b/features/http_pack/pack.py@@ -92,6 +92,7 @@ async def _probe(url: str, headers: dict, proxies: dict) -> tuple[int, bool, strlogger.info("偏移 Range 探测返回 200, content-length: {}",responseHeaders.get("content-length", ""))if fileSize in {SpecialFileSize.UNKNOWN, 1}:+ # bytes=0- 和 bytes=0-0 哪个更好存疑fallbackStatus, fallbackHeaders, _ = await _sendProbe(client,url,@@ -131,7 +132,7 @@ def _fileName(url: str, headers: dict) -> str:if "filename*" in paramDict:val = paramDict["filename*"]- if "'" in val:+ if "'" in val: # charset'lang'encoded_textparts = val.split("'", 2)if len(parts) == 3:encoding, _, encodedText = partsdiff --git a/features/http_pack/task.py b/features/http_pack/task.pyindex 1f984a97..0e634bc8 100644--- a/features/http_pack/task.py+++ b/features/http_pack/task.py@@ -75,7 +75,7 @@ class HttpWorker(Worker):return requestHeadersasync def handleSubworker(self, subworker: HttpSubworker):- if subworker.end == SpecialFileSize.UNKNOWN:+ if subworker.end == SpecialFileSize.UNKNOWN: # 支持断点续传, 但文件大小未知while True:try:res = await self.client.get(@@ -110,7 +110,7 @@ class HttpWorker(Worker):)await asyncio.sleep(5)- elif subworker.end == SpecialFileSize.NOT_SUPPORTED:+ elif subworker.end == SpecialFileSize.NOT_SUPPORTED: # 不支持断点续传while True:try:ftruncate(self.fileHandle, 0)@@ -151,7 +151,7 @@ class HttpWorker(Worker):)await asyncio.sleep(5)- else:+ else: # 正常下载while subworker.progress <= subworker.end:try:res = await self.client.get(@@ -278,7 +278,7 @@ class HttpWorker(Worker):try:with open(recordFile, "rb") as f:while True:- data = f.read(24)+ data = f.read(24) # 每个 subworker 3 个 uint64, 共 24 字节if not data:breakstart, progress, end = unpack("<QQQ", data)diff --git a/features/m3u8_pack/task.py b/features/m3u8_pack/task.pyindex 789462ff..d4b34d15 100644--- a/features/m3u8_pack/task.py+++ b/features/m3u8_pack/task.py@@ -77,7 +77,6 @@ def _isLive(manifestType: str, body: str) -> bool:def _title(url: str, headers: dict[str, str], extension: str) -> str:candidates: list[str] = []- # Content-Disposition filename 解析cd = headers.get("content-disposition", "")if cd:msg = Message()@@ -331,7 +330,6 @@ M3U8TaskStage.workerType = M3U8Workerasync def createInstallTask() -> Task:from app.services.feature_service import featureService- # 检测当前平台machine = platform.machine().lower()if sys.platform == "win32":if machine in {"amd64", "x86_64"}:@@ -354,7 +352,6 @@ async def createInstallTask() -> Task:else:raise RuntimeError(f"当前平台暂不支持一键安装 N_m3u8DL-RE: {sys.platform}")- # 请求 GitHub Releaseclient = niquests.AsyncSession(headers=_M3U8DL_RELEASE_HEADERS, timeout=30, happy_eyeballs=True)client.trust_env = Falsetry:@@ -376,7 +373,6 @@ async def createInstallTask() -> Task:if not isinstance(assets, list):raise RuntimeError("GitHub Release 返回了无效的 assets 数据")- # 匹配当前平台的 assetasset = Nonefor item in assets:if target in str(item.get("name") or ""):@@ -391,7 +387,6 @@ async def createInstallTask() -> Task:if not downloadUrl or not assetName or size <= 0:raise RuntimeError("GitHub Release 返回了不完整的安装包信息")- # 构建安装任务installFolder = m3u8Config.installFolder.valuedownloadPayload = {"url": downloadUrl,