The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
refactor: 整理 GitHub 功能包
XiaoYouChR494c11b3a439
diff --git a/features/ffmpeg_pack/task.py b/features/ffmpeg_pack/task.pyindex af0d128d..bea33ce1 100644--- a/features/ffmpeg_pack/task.py+++ b/features/ffmpeg_pack/task.py@@ -37,7 +37,7 @@ class FFmpegWorker(Worker):return 0.0return duration if duration > 0 else 0.0- async def _getDuration(self, ffprobe: str, path: str) -> float:+ async def _fetchDuration(self, ffprobe: str, path: str) -> float:process = await asyncio.create_subprocess_exec(ffprobe,"-v", "error",@@ -92,7 +92,7 @@ class FFmpegWorker(Worker):self.stage.progress = 0self.stage.speed = 0self.stage.receivedBytes = 0- totalDuration = await self._getDuration(ffprobe, self.stage.videoPath)+ totalDuration = await self._fetchDuration(ffprobe, self.stage.videoPath)process = await asyncio.create_subprocess_exec(ffmpeg,"-y", "-v", "error", "-nostats", "-progress", "pipe:1",diff --git a/features/github_pack/config.py b/features/github_pack/config.pyindex 9e878f4f..555a5db5 100644--- a/features/github_pack/config.py+++ b/features/github_pack/config.py@@ -89,7 +89,7 @@ class GitHubProxySiteValidator(ConfigValidator):return site if self.validate(site) else ""-def getSelectedProxySite() -> str:+def selectedProxySite() -> str:if githubConfig.proxySite.value == GITHUB_CUSTOM_PROXY_SITE:return githubConfig.customProxySite.valuereturn githubConfig.proxySite.valuediff --git a/features/github_pack/pack.py b/features/github_pack/pack.pyindex ca73bf23..5638df75 100644--- a/features/github_pack/pack.py+++ b/features/github_pack/pack.py@@ -3,7 +3,7 @@ from urllib.parse import urlparsefrom app.bases.interfaces import FeaturePackfrom app.bases.models import Task-from .config import githubConfig, getSelectedProxySite+from .config import githubConfig, selectedProxySiteif TYPE_CHECKING:from features.http_pack.pack import HttpPack@@ -47,23 +47,18 @@ def _isSupportedGitHubUrl(url: str) -> bool:)-def _buildProxyUrl(url: str) -> str:- proxySite = getSelectedProxySite()- return f"{proxySite.rstrip('/')}/{url.lstrip('/')}"--class GitHubPack(FeaturePack):packId = "github"priority = 90config = githubConfigdef matches(self, url: str) -> bool:- return self.config.enabled.value and bool(getSelectedProxySite()) and _isSupportedGitHubUrl(url)+ return self.config.enabled.value and bool(selectedProxySite()) and _isSupportedGitHubUrl(url)async def resolve(self, payload: dict) -> dict:originalUrl = str(payload["url"]).strip()proxiedPayload = payload.copy()- proxiedPayload["url"] = _buildProxyUrl(originalUrl)+ proxiedPayload["url"] = f"{selectedProxySite().rstrip('/')}/{originalUrl.lstrip('/')}"httpPack = HttpPack()resolvedPayload = await httpPack.resolve(proxiedPayload)