From 2a99e595ce53c0ef1ecef0fad67319dff0001fec Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sat, 30 Nov 2024 03:04:33 +0800 Subject: [PATCH] =?UTF-8?q?Do=20not=20force=20fetching=20yt-dlp,=20i?= =?UTF-8?q?t=20does=20not=20work;=20use=20MacPorts=E2=80=99=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/qmplay2/YouTubeDL.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git src/qmplay2/YouTubeDL.cpp src/qmplay2/YouTubeDL.cpp index 98071fea..b87f64af 100644 --- src/qmplay2/YouTubeDL.cpp +++ src/qmplay2/YouTubeDL.cpp @@ -28,6 +28,11 @@ #include #include +/* Avoid downloading yt-dlp, it fails to work correctly. */ +#ifndef BUNDLED_YTDLP +#define BUNDLED_YTDLP 0 +#endif + constexpr char g_name[] = "YouTubeDL"; static QReadWriteLock g_lock; @@ -263,6 +268,7 @@ QStringList YouTubeDL::exec(const QString &url, const QStringList &args, QString if (error.indexOf("ERROR: ") == 0) error.remove(0, 7); } + #if BUNDLED_YTDLP if (canUpdate && !error.contains("said:")) // Probably update can fix the error, so do it! { if (!doLock(Lock::Write, true)) // Unlock for read and lock for write @@ -300,6 +306,7 @@ QStringList YouTubeDL::exec(const QString &url, const QStringList &args, QString if (!doLock(Lock::Read, true)) // Unlock for write and lock for read return {}; } + #endif finishWithError(error); return {}; } @@ -317,6 +324,7 @@ QStringList YouTubeDL::exec(const QString &url, const QStringList &args, QString g_lock.unlock(); // Unlock for read return result; } +#if BUNDLED_YTDLP else if (canUpdate && !m_aborted && m_process.error() == QProcess::FailedToStart) { const QString downloadUrl = "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp" @@ -361,6 +369,7 @@ QStringList YouTubeDL::exec(const QString &url, const QStringList &args, QString QMPlay2Core.setWorking(false); } } +#endif g_lock.unlock(); // Unlock for read or for write (if download has failed) #else