The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
refactor: 移除冗余代码和未使用的变量
XiaoYouChRc8edfbd916b2
diff --git a/app/bases/models.py b/app/bases/models.pyindex 42fcf01f..cd011785 100644--- a/app/bases/models.py+++ b/app/bases/models.py@@ -263,19 +263,17 @@ class Task:return self.updateStatus()def pendingStages(self) -> Iterable[TaskStage]:+ from app.supports.recorder import taskRecorder+self.stages.sort(key=lambda stage: stage.stageIndex)for stage in self.stages:if self.status != TaskStatus.RUNNING:breakif stage.status == TaskStatus.COMPLETED:continue- self._onStageStarted(stage)+ taskRecorder.flush()yield stage- def _onStageStarted(self, stage: TaskStage):- from app.supports.recorder import taskRecorder- taskRecorder.flush()-def setSelection(self, selectedIndexes: list[int]):if self.files is None or self.stageType is None:returndiff --git a/app/services/browser_service.py b/app/services/browser_service.pyindex a1d2f91d..da874d89 100644--- a/app/services/browser_service.py+++ b/app/services/browser_service.py@@ -13,7 +13,6 @@ from qfluentwidgets import MessageBoxfrom app.bases.models import Task, TaskStatusfrom app.services.core_service import coreService-from app.services.feature_service import featureServicefrom app.supports.config import VERSION, cfgfrom app.supports.recorder import taskRecorderfrom app.supports.utils import bringWindowToTop, getProxies, openFile, openFolderdiff --git a/features/bili_pack/config.py b/features/bili_pack/config.pyindex a875a823..c397ae4c 100644--- a/features/bili_pack/config.py+++ b/features/bili_pack/config.py@@ -91,7 +91,6 @@ class ScanLoginDialog(MessageBoxBase):self._loginUrl = ""self._generation = 0self._generating = False- self._polling = Falseself._closed = Falseself.setClosableOnMaskClicked(True)@@ -161,7 +160,6 @@ class ScanLoginDialog(MessageBoxBase):self._generation += 1self._generating = True- self._polling = Falseself.cookie = ""self._qrCodeKey = ""self._loginUrl = ""@@ -200,7 +198,6 @@ class ScanLoginDialog(MessageBoxBase):self.openBrowserButton.setEnabled(True)self.statusLabel.setText(self.tr("等待扫码并在手机端确认登录"))- self._polling = Truegeneration = self._generationcoreService.runCoroutine(pollQrLogin(@@ -230,8 +227,6 @@ class ScanLoginDialog(MessageBoxBase):if self._closed or generation != self._generation:return- self._polling = False-if error:self.statusLabel.setText(self.tr('轮询扫码状态失败,请点击"刷新二维码"重试'))returndiff --git a/features/bili_pack/pack.py b/features/bili_pack/pack.pyindex 3aefbaf3..82e96944 100644--- a/features/bili_pack/pack.py+++ b/features/bili_pack/pack.py@@ -1,6 +1,5 @@import refrom pathlib import Path-from typing import TYPE_CHECKINGfrom urllib.parse import parse_qs, urlparseimport niquestsdiff --git a/features/bittorrent_pack/cards.py b/features/bittorrent_pack/cards.pyindex 9d296aa1..886d0d32 100644--- a/features/bittorrent_pack/cards.py+++ b/features/bittorrent_pack/cards.py@@ -1,7 +1,7 @@import shutil-from pathlib import Path, PurePosixPath+from pathlib import Path-from PySide6.QtCore import Qt, QFileInfo+from PySide6.QtCore import Qtfrom PySide6.QtWidgets import (QHBoxLayout,QVBoxLayout,diff --git a/features/bittorrent_pack/config.py b/features/bittorrent_pack/config.pyindex 93f7e72f..85a37c8c 100644--- a/features/bittorrent_pack/config.py+++ b/features/bittorrent_pack/config.py@@ -12,7 +12,6 @@ from qfluentwidgets import (MessageBoxBase,OptionsConfigItem,OptionsValidator,- PlainTextEdit,PrimaryPushButton,RangeConfigItem,RangeSettingCard,diff --git a/features/bittorrent_pack/pack.py b/features/bittorrent_pack/pack.pyindex a259d11f..16a5c03d 100644--- a/features/bittorrent_pack/pack.py+++ b/features/bittorrent_pack/pack.py@@ -8,7 +8,7 @@ from app.services.core_service import coreServicefrom .cards import BitTorrentResultCard, BTTaskCardfrom .config import bittorrentConfig, getCachedWebTrackers, refreshConfiguredWebTrackers-from .task import BTTask, resolve as _btResolve, loadLocalTorrent+from .task import resolve as _btResolve, loadLocalTorrentdef _isTorrentUrl(url: str) -> bool:diff --git a/features/ffmpeg_pack/pack.py b/features/ffmpeg_pack/pack.pyindex c5aec7f1..8f7c75ae 100644--- a/features/ffmpeg_pack/pack.py+++ b/features/ffmpeg_pack/pack.py@@ -5,7 +5,6 @@ from typing import Any, TYPE_CHECKINGfrom urllib.parse import urlparseimport niquests-from loguru import loggerfrom app.bases.interfaces import FeaturePackfrom app.bases.models import Task, SpecialFileSizediff --git a/features/ftp_pack/pack.py b/features/ftp_pack/pack.pyindex cd859217..49483088 100644--- a/features/ftp_pack/pack.py+++ b/features/ftp_pack/pack.py@@ -4,7 +4,7 @@ from app.bases.interfaces import FeaturePackfrom app.bases.models import Taskfrom .cards import FtpResultCard, FtpTaskCard-from .task import FtpTask, resolve as _ftpResolve+from .task import resolve as _ftpResolveclass FtpPack(FeaturePack):diff --git a/features/m3u8_pack/task.py b/features/m3u8_pack/task.pyindex e8941720..2c0656d3 100644--- a/features/m3u8_pack/task.py+++ b/features/m3u8_pack/task.py@@ -6,11 +6,10 @@ from contextlib import suppressfrom dataclasses import dataclass, fieldfrom email.message import Messagefrom pathlib import Path-from typing import Any, TYPE_CHECKING+from typing import TYPE_CHECKINGfrom urllib.parse import parse_qs, unquote, urlparseimport niquests-from loguru import loggerfrom app.bases.interfaces import Workerfrom app.bases.models import Task, TaskStage, TaskStatus@@ -127,7 +126,7 @@ class M3U8Worker(Worker):self.stage = stageself.task = stage.task- def _buildArgs(self, downloaderPath: str) -> list[str]:+ def _buildArgs(self) -> list[str]:meta = self.task.metadatasaveName = meta.get("saveName", _stem(self.task.title))@@ -284,7 +283,7 @@ class M3U8Worker(Worker):process = NonesupervisorTask = Nonetry:- args = self._buildArgs(execPath)+ args = self._buildArgs()process = await asyncio.create_subprocess_exec(execPath,*args,