The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(yt-dlp): 自定义安装路径后 Draft 不再重置配置
XiaoYouChR93ffb267f4bd
diff --git a/features/yt_dlp_pack/cards.py b/features/yt_dlp_pack/cards.pyindex 5b75b4ba..8d03b242 100644--- a/features/yt_dlp_pack/cards.py+++ b/features/yt_dlp_pack/cards.py@@ -1,5 +1,6 @@from __future__ import annotations+import asynciofrom pathlib import Pathfrom PySide6.QtCore import QCoreApplication, Qt, QT_TRANSLATE_NOOP as N@@ -21,7 +22,7 @@ from app.view.components.track_bar import TrackBar, TrackButtonfrom app.view.components.tree_view import AutoSizingTreeViewfrom app.view.dialogs.subtitle_select import SubtitleSelectDialogfrom .config import ytDlpConfig-from .task import STEPS_PER_VIDEO, YouTubeCoverStep, YouTubeTask, buildFormatPair+from .task import STEPS_PER_VIDEO, YouTubeCoverStep, YouTubeTask, buildFormatPair, probeFormats, probePlaylistdef toCodecName(codec: str) -> str:@@ -498,10 +499,8 @@ class YtDlpDraftCard(DraftCard):self._refreshFileIcon()def _startMediaInfoFetch(self) -> None:- from features.yt_dlp_pack.pack import YouTubeParser- parser = YouTubeParser()self._coroutineRunner.submit(- parser.fetchFormats(self._task.url),+ asyncio.to_thread(probeFormats, self._task.url),done=self._onMediaInfoLoaded,failed=self._onMediaInfoFailed,owner=self,@@ -626,10 +625,8 @@ class YtDlpDraftCard(DraftCard):if not task.files:self._videoSelectButton.hide()self._playlistSpinner.show()- from features.yt_dlp_pack.pack import YouTubeParser- parser = YouTubeParser()self._coroutineRunner.submit(- parser.fetchPlaylist(task.url),+ asyncio.to_thread(probePlaylist, task.url),done=self._onPlaylistLoaded,failed=self._onPlaylistFailed,owner=self,diff --git a/features/yt_dlp_pack/pack.py b/features/yt_dlp_pack/pack.pyindex 3201f76a..c9d59969 100644--- a/features/yt_dlp_pack/pack.py+++ b/features/yt_dlp_pack/pack.py@@ -1,6 +1,5 @@from __future__ import annotations-import asynciofrom urllib.parse import urlparse, parse_qs, quotefrom app.models.pack import FeaturePack, TaskParser@@ -10,7 +9,7 @@ from loguru import loggerfrom .cards import YtDlpDraftCard, YtDlpTaskCardfrom .config import ytDlpConfig, youTubeRuntime-from .task import YouTubeTask, buildStepGroup, probeFormats, probePlaylist+from .task import YouTubeTask, buildStepGroupYOUTUBE_HOSTS = ("youtube.com", "youtu.be")@@ -45,28 +44,6 @@ class YouTubeParser(TaskParser):task.addStep(step)return task- async def fetchFormats(self, url: str) -> dict:- from .config import youTubeRuntime- runtimePath = youTubeRuntime.path()- if not runtimePath:- logger.warning("fetchFormats skipped: runtime not found (installFolder={})", youTubeRuntime.ytDlpFolder())- return {}- try:- return await asyncio.to_thread(probeFormats, url)- except Exception as e:- logger.opt(exception=e).warning("fetchFormats failed for {}", url)- return {}-- async def fetchPlaylist(self, url: str) -> list[dict]:- from .config import youTubeRuntime- if not youTubeRuntime.path():- return []- try:- return await asyncio.to_thread(probePlaylist, url)- except Exception as e:- logger.opt(exception=e).warning("fetchPlaylist failed for {}", url)- return []-async def _fetchTitle(self, url: str) -> str:from app.client import buildClientoembedUrl = f"https://www.youtube.com/oembed?url={quote(url, safe='')}&format=json"