Support paths with spaces for yt-dlp

release
aandrew-me 5 days ago
parent 39324c1055
commit b73980e38d

@ -106,7 +106,7 @@ const playlistDownloader = {
loadInitialConfig() { loadInitialConfig() {
// yt-dlp path // yt-dlp path
this.state.ytDlpPath = localStorage.getItem("ytdlp"); this.state.ytDlpPath = localStorage.getItem("ytdlp");
this.state.ytDlpWrap = new YTDlpWrap(this.state.ytDlpPath); this.state.ytDlp = new YTDlpWrap(`"${this.state.ytDlpPath}"`);
const defaultDownloadsDir = path.join(os.homedir(), "Downloads"); const defaultDownloadsDir = path.join(os.homedir(), "Downloads");
let preferredDir = let preferredDir =
@ -142,9 +142,13 @@ const playlistDownloader = {
initEventListeners() { initEventListeners() {
this.ui.pasteLinkBtn.addEventListener("click", () => this.pasteLink()); this.ui.pasteLinkBtn.addEventListener("click", () => this.pasteLink());
document.addEventListener("keydown", (event) => { document.addEventListener("keydown", (event) => {
if ((event.ctrlKey && event.key === "v") || (event.metaKey && event.key === "v" && os.platform() === "darwin") && if (
document.activeElement.tagName !== "INPUT" && (event.ctrlKey && event.key === "v") ||
document.activeElement.tagName !== "TEXTAREA" (event.metaKey &&
event.key === "v" &&
os.platform() === "darwin" &&
document.activeElement.tagName !== "INPUT" &&
document.activeElement.tagName !== "TEXTAREA")
) { ) {
this.pasteLink(); this.pasteLink();
} }

@ -142,7 +142,7 @@ class YtDownloaderApp {
try { try {
this.state.ytDlpPath = await this._findOrDownloadYtDlp(); this.state.ytDlpPath = await this._findOrDownloadYtDlp();
this.state.ytDlp = new YTDlpWrap(this.state.ytDlpPath); this.state.ytDlp = new YTDlpWrap(`"${this.state.ytDlpPath}"`);
this.state.ffmpegPath = await this._findFfmpeg(); this.state.ffmpegPath = await this._findFfmpeg();
this.state.jsRuntimePath = await this._getJsRuntimePath(); this.state.jsRuntimePath = await this._getJsRuntimePath();

Loading…
Cancel
Save